@@ -385,9 +385,6 @@ pub(super) struct Channel<ChanSigner: ChannelKeys> {
385385
386386 their_shutdown_scriptpubkey : Option < Script > ,
387387
388- /// Used exclusively to broadcast the latest local state, mostly a historical quirk that this
389- /// is here:
390- channel_monitor : Option < ChannelMonitor < ChanSigner > > ,
391388 commitment_secrets : CounterpartyCommitmentSecrets ,
392389
393390 network_sync : UpdateStatus ,
@@ -557,7 +554,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
557554
558555 their_shutdown_scriptpubkey : None ,
559556
560- channel_monitor : None ,
561557 commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
562558
563559 network_sync : UpdateStatus :: Fresh ,
@@ -787,7 +783,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
787783
788784 their_shutdown_scriptpubkey,
789785
790- channel_monitor : None ,
791786 commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
792787
793788 network_sync : UpdateStatus :: Fresh ,
@@ -1289,7 +1284,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
12891284 payment_preimage: payment_preimage_arg. clone( ) ,
12901285 } ] ,
12911286 } ;
1292- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
12931287
12941288 if ( self . channel_state & ( ChannelState :: AwaitingRemoteRevoke as u32 | ChannelState :: PeerDisconnected as u32 | ChannelState :: MonitorUpdateFailed as u32 ) ) != 0 {
12951289 for pending_update in self . holding_cell_htlc_updates . iter ( ) {
@@ -1619,7 +1613,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
16191613 } }
16201614 }
16211615
1622- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
16231616 let channel_monitor = create_monitor ! ( ) ;
16241617
16251618 self . channel_state = ChannelState :: FundingSent as u32 ;
@@ -1685,7 +1678,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
16851678 } }
16861679 }
16871680
1688- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
16891681 let channel_monitor = create_monitor ! ( ) ;
16901682
16911683 assert_eq ! ( self . channel_state & ( ChannelState :: MonitorUpdateFailed as u32 ) , 0 ) ; // We have no had any monitor(s) yet to fail update!
@@ -2138,7 +2130,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
21382130 htlc_outputs: htlcs_and_sigs
21392131 } ]
21402132 } ;
2141- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
21422133
21432134 for htlc in self . pending_inbound_htlcs . iter_mut ( ) {
21442135 let new_forward = if let & InboundHTLCState :: RemoteAnnounced ( ref forward_info) = & htlc. state {
@@ -2358,7 +2349,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
23582349 secret: msg. per_commitment_secret,
23592350 } ] ,
23602351 } ;
2361- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
23622352
23632353 // Update state now that we've passed all the can-fail calls...
23642354 // (note that we may still fail to generate the new commitment_signed message, but that's
@@ -3466,9 +3456,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
34663456 if header. bitcoin_hash ( ) != self . last_block_connected {
34673457 self . last_block_connected = header. bitcoin_hash ( ) ;
34683458 self . update_time_counter = cmp:: max ( self . update_time_counter , header. time ) ;
3469- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3470- channel_monitor. last_block_hash = self . last_block_connected ;
3471- }
34723459 if self . funding_tx_confirmations > 0 {
34733460 if self . funding_tx_confirmations == self . minimum_depth as u64 {
34743461 let need_commitment_update = if non_shutdown_state == ChannelState :: FundingSent as u32 {
@@ -3527,9 +3514,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
35273514 self . funding_tx_confirmations = self . minimum_depth as u64 - 1 ;
35283515 }
35293516 self . last_block_connected = header. bitcoin_hash ( ) ;
3530- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3531- channel_monitor. last_block_hash = self . last_block_connected ;
3532- }
35333517 false
35343518 }
35353519
@@ -3940,7 +3924,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
39403924 their_revocation_point: self . their_cur_commitment_point. unwrap( )
39413925 } ]
39423926 } ;
3943- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
39443927 self . channel_state |= ChannelState :: AwaitingRemoteRevoke as u32 ;
39453928 Ok ( ( res, monitor_update) )
39463929 }
@@ -4317,8 +4300,6 @@ impl<ChanSigner: ChannelKeys + Writeable> Writeable for Channel<ChanSigner> {
43174300 self . their_shutdown_scriptpubkey . write ( writer) ?;
43184301
43194302 self . commitment_secrets . write ( writer) ?;
4320-
4321- self . channel_monitor . as_ref ( ) . unwrap ( ) . write_for_disk ( writer) ?;
43224303 Ok ( ( ) )
43234304 }
43244305}
@@ -4485,13 +4466,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
44854466 let their_shutdown_scriptpubkey = Readable :: read ( reader) ?;
44864467 let commitment_secrets = Readable :: read ( reader) ?;
44874468
4488- let ( monitor_last_block, channel_monitor) = Readable :: read ( reader) ?;
4489- // We drop the ChannelMonitor's last block connected hash cause we don't actually bother
4490- // doing full block connection operations on the internal ChannelMonitor copies
4491- if monitor_last_block != last_block_connected {
4492- return Err ( DecodeError :: InvalidValue ) ;
4493- }
4494-
44954469 Ok ( Channel {
44964470 user_id,
44974471
@@ -4564,7 +4538,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
45644538
45654539 their_shutdown_scriptpubkey,
45664540
4567- channel_monitor : Some ( channel_monitor) ,
45684541 commitment_secrets,
45694542
45704543 network_sync : UpdateStatus :: Fresh ,
0 commit comments