@@ -386,9 +386,6 @@ pub(super) struct Channel<ChanSigner: ChannelKeys> {
386386
387387 their_shutdown_scriptpubkey : Option < Script > ,
388388
389- /// Used exclusively to broadcast the latest local state, mostly a historical quirk that this
390- /// is here:
391- channel_monitor : Option < ChannelMonitor < ChanSigner > > ,
392389 commitment_secrets : CounterpartyCommitmentSecrets ,
393390
394391 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 ,
@@ -786,7 +782,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
786782
787783 their_shutdown_scriptpubkey,
788784
789- channel_monitor : None ,
790785 commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
791786
792787 network_sync : UpdateStatus :: Fresh ,
@@ -1222,7 +1217,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
12221217 payment_preimage: payment_preimage_arg. clone( ) ,
12231218 } ] ,
12241219 } ;
1225- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
12261220
12271221 if ( self . channel_state & ( ChannelState :: AwaitingRemoteRevoke as u32 | ChannelState :: PeerDisconnected as u32 | ChannelState :: MonitorUpdateFailed as u32 ) ) != 0 {
12281222 for pending_update in self . holding_cell_htlc_updates . iter ( ) {
@@ -1552,7 +1546,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
15521546 } }
15531547 }
15541548
1555- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
15561549 let channel_monitor = create_monitor ! ( ) ;
15571550
15581551 self . channel_state = ChannelState :: FundingSent as u32 ;
@@ -1618,7 +1611,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
16181611 } }
16191612 }
16201613
1621- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
16221614 let channel_monitor = create_monitor ! ( ) ;
16231615
16241616 assert_eq ! ( self . channel_state & ( ChannelState :: MonitorUpdateFailed as u32 ) , 0 ) ; // We have no had any monitor(s) yet to fail update!
@@ -2060,7 +2052,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
20602052 htlc_outputs: htlcs_and_sigs
20612053 } ]
20622054 } ;
2063- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
20642055
20652056 for htlc in self . pending_inbound_htlcs . iter_mut ( ) {
20662057 let new_forward = if let & InboundHTLCState :: RemoteAnnounced ( ref forward_info) = & htlc. state {
@@ -2280,7 +2271,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
22802271 secret: msg. per_commitment_secret,
22812272 } ] ,
22822273 } ;
2283- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
22842274
22852275 // Update state now that we've passed all the can-fail calls...
22862276 // (note that we may still fail to generate the new commitment_signed message, but that's
@@ -3115,14 +3105,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
31153105 self . user_id
31163106 }
31173107
3118- /// May only be called after funding has been initiated (ie is_funding_initiated() is true)
3119- pub fn channel_monitor ( & mut self ) -> & mut ChannelMonitor < ChanSigner > {
3120- if self . channel_state < ChannelState :: FundingSent as u32 {
3121- panic ! ( "Can't get a channel monitor until funding has been created" ) ;
3122- }
3123- self . channel_monitor . as_mut ( ) . unwrap ( )
3124- }
3125-
31263108 /// Guaranteed to be Some after both FundingLocked messages have been exchanged (and, thus,
31273109 /// is_usable() returns true).
31283110 /// Allowed in any state (including after shutdown)
@@ -3397,9 +3379,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33973379 if header. bitcoin_hash ( ) != self . last_block_connected {
33983380 self . last_block_connected = header. bitcoin_hash ( ) ;
33993381 self . update_time_counter = cmp:: max ( self . update_time_counter , header. time ) ;
3400- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3401- channel_monitor. last_block_hash = self . last_block_connected ;
3402- }
34033382 if self . funding_tx_confirmations > 0 {
34043383 if self . funding_tx_confirmations == self . minimum_depth as u64 {
34053384 let need_commitment_update = if non_shutdown_state == ChannelState :: FundingSent as u32 {
@@ -3458,9 +3437,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
34583437 self . funding_tx_confirmations = self . minimum_depth as u64 - 1 ;
34593438 }
34603439 self . last_block_connected = header. bitcoin_hash ( ) ;
3461- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3462- channel_monitor. last_block_hash = self . last_block_connected ;
3463- }
34643440 false
34653441 }
34663442
@@ -3871,7 +3847,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
38713847 their_revocation_point: self . their_cur_commitment_point. unwrap( )
38723848 } ]
38733849 } ;
3874- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
38753850 self . channel_state |= ChannelState :: AwaitingRemoteRevoke as u32 ;
38763851 Ok ( ( res, monitor_update) )
38773852 }
@@ -4242,8 +4217,6 @@ impl<ChanSigner: ChannelKeys + Writeable> Writeable for Channel<ChanSigner> {
42424217 self . their_shutdown_scriptpubkey . write ( writer) ?;
42434218
42444219 self . commitment_secrets . write ( writer) ?;
4245-
4246- self . channel_monitor . as_ref ( ) . unwrap ( ) . write_for_disk ( writer) ?;
42474220 Ok ( ( ) )
42484221 }
42494222}
@@ -4398,13 +4371,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
43984371 let their_shutdown_scriptpubkey = Readable :: read ( reader) ?;
43994372 let commitment_secrets = Readable :: read ( reader) ?;
44004373
4401- let ( monitor_last_block, channel_monitor) = Readable :: read ( reader) ?;
4402- // We drop the ChannelMonitor's last block connected hash cause we don't actually bother
4403- // doing full block connection operations on the internal ChannelMonitor copies
4404- if monitor_last_block != last_block_connected {
4405- return Err ( DecodeError :: InvalidValue ) ;
4406- }
4407-
44084374 Ok ( Channel {
44094375 user_id,
44104376
@@ -4476,7 +4442,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
44764442
44774443 their_shutdown_scriptpubkey,
44784444
4479- channel_monitor : Some ( channel_monitor) ,
44804445 commitment_secrets,
44814446
44824447 network_sync : UpdateStatus :: Fresh ,
0 commit comments