@@ -390,9 +390,6 @@ pub(super) struct Channel<ChanSigner: ChannelKeys> {
390
390
391
391
their_shutdown_scriptpubkey : Option < Script > ,
392
392
393
- /// Used exclusively to broadcast the latest local state, mostly a historical quirk that this
394
- /// is here:
395
- channel_monitor : Option < ChannelMonitor < ChanSigner > > ,
396
393
commitment_secrets : CounterpartyCommitmentSecrets ,
397
394
398
395
network_sync : UpdateStatus ,
@@ -562,7 +559,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
562
559
563
560
their_shutdown_scriptpubkey : None ,
564
561
565
- channel_monitor : None ,
566
562
commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
567
563
568
564
network_sync : UpdateStatus :: Fresh ,
@@ -792,7 +788,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
792
788
793
789
their_shutdown_scriptpubkey,
794
790
795
- channel_monitor : None ,
796
791
commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
797
792
798
793
network_sync : UpdateStatus :: Fresh ,
@@ -1284,7 +1279,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1284
1279
payment_preimage: payment_preimage_arg. clone( ) ,
1285
1280
} ] ,
1286
1281
} ;
1287
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
1288
1282
1289
1283
if ( self . channel_state & ( ChannelState :: AwaitingRemoteRevoke as u32 | ChannelState :: PeerDisconnected as u32 | ChannelState :: MonitorUpdateFailed as u32 ) ) != 0 {
1290
1284
for pending_update in self . holding_cell_htlc_updates . iter ( ) {
@@ -1614,7 +1608,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1614
1608
} }
1615
1609
}
1616
1610
1617
- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
1618
1611
let channel_monitor = create_monitor ! ( ) ;
1619
1612
1620
1613
self . channel_state = ChannelState :: FundingSent as u32 ;
@@ -1680,7 +1673,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1680
1673
} }
1681
1674
}
1682
1675
1683
- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
1684
1676
let channel_monitor = create_monitor ! ( ) ;
1685
1677
1686
1678
assert_eq ! ( self . channel_state & ( ChannelState :: MonitorUpdateFailed as u32 ) , 0 ) ; // We have no had any monitor(s) yet to fail update!
@@ -2139,7 +2131,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2139
2131
htlc_outputs: htlcs_and_sigs
2140
2132
} ]
2141
2133
} ;
2142
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
2143
2134
2144
2135
for htlc in self . pending_inbound_htlcs . iter_mut ( ) {
2145
2136
let new_forward = if let & InboundHTLCState :: RemoteAnnounced ( ref forward_info) = & htlc. state {
@@ -2359,7 +2350,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2359
2350
secret: msg. per_commitment_secret,
2360
2351
} ] ,
2361
2352
} ;
2362
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
2363
2353
2364
2354
// Update state now that we've passed all the can-fail calls...
2365
2355
// (note that we may still fail to generate the new commitment_signed message, but that's
@@ -3473,9 +3463,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3473
3463
if header. bitcoin_hash ( ) != self . last_block_connected {
3474
3464
self . last_block_connected = header. bitcoin_hash ( ) ;
3475
3465
self . update_time_counter = cmp:: max ( self . update_time_counter , header. time ) ;
3476
- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3477
- channel_monitor. last_block_hash = self . last_block_connected ;
3478
- }
3479
3466
if self . funding_tx_confirmations > 0 {
3480
3467
if self . funding_tx_confirmations == self . minimum_depth as u64 {
3481
3468
let need_commitment_update = if non_shutdown_state == ChannelState :: FundingSent as u32 {
@@ -3534,9 +3521,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3534
3521
self . funding_tx_confirmations = self . minimum_depth as u64 - 1 ;
3535
3522
}
3536
3523
self . last_block_connected = header. bitcoin_hash ( ) ;
3537
- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3538
- channel_monitor. last_block_hash = self . last_block_connected ;
3539
- }
3540
3524
false
3541
3525
}
3542
3526
@@ -3947,7 +3931,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3947
3931
their_revocation_point: self . their_cur_commitment_point. unwrap( )
3948
3932
} ]
3949
3933
} ;
3950
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
3951
3934
self . channel_state |= ChannelState :: AwaitingRemoteRevoke as u32 ;
3952
3935
Ok ( ( res, monitor_update) )
3953
3936
}
@@ -4326,8 +4309,6 @@ impl<ChanSigner: ChannelKeys + Writeable> Writeable for Channel<ChanSigner> {
4326
4309
self . their_shutdown_scriptpubkey . write ( writer) ?;
4327
4310
4328
4311
self . commitment_secrets . write ( writer) ?;
4329
-
4330
- self . channel_monitor . as_ref ( ) . unwrap ( ) . write_for_disk ( writer) ?;
4331
4312
Ok ( ( ) )
4332
4313
}
4333
4314
}
@@ -4495,13 +4476,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
4495
4476
let their_shutdown_scriptpubkey = Readable :: read ( reader) ?;
4496
4477
let commitment_secrets = Readable :: read ( reader) ?;
4497
4478
4498
- let ( monitor_last_block, channel_monitor) = Readable :: read ( reader) ?;
4499
- // We drop the ChannelMonitor's last block connected hash cause we don't actually bother
4500
- // doing full block connection operations on the internal ChannelMonitor copies
4501
- if monitor_last_block != last_block_connected {
4502
- return Err ( DecodeError :: InvalidValue ) ;
4503
- }
4504
-
4505
4479
Ok ( Channel {
4506
4480
user_id,
4507
4481
@@ -4574,7 +4548,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
4574
4548
4575
4549
their_shutdown_scriptpubkey,
4576
4550
4577
- channel_monitor : Some ( channel_monitor) ,
4578
4551
commitment_secrets,
4579
4552
4580
4553
network_sync : UpdateStatus :: Fresh ,
0 commit comments