@@ -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 ,
@@ -1281,7 +1276,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1281
1276
payment_preimage: payment_preimage_arg. clone( ) ,
1282
1277
} ] ,
1283
1278
} ;
1284
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
1285
1279
1286
1280
if ( self . channel_state & ( ChannelState :: AwaitingRemoteRevoke as u32 | ChannelState :: PeerDisconnected as u32 | ChannelState :: MonitorUpdateFailed as u32 ) ) != 0 {
1287
1281
for pending_update in self . holding_cell_htlc_updates . iter ( ) {
@@ -1611,7 +1605,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1611
1605
} }
1612
1606
}
1613
1607
1614
- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
1615
1608
let channel_monitor = create_monitor ! ( ) ;
1616
1609
1617
1610
self . channel_state = ChannelState :: FundingSent as u32 ;
@@ -1677,7 +1670,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1677
1670
} }
1678
1671
}
1679
1672
1680
- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
1681
1673
let channel_monitor = create_monitor ! ( ) ;
1682
1674
1683
1675
assert_eq ! ( self . channel_state & ( ChannelState :: MonitorUpdateFailed as u32 ) , 0 ) ; // We have no had any monitor(s) yet to fail update!
@@ -2136,7 +2128,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2136
2128
htlc_outputs: htlcs_and_sigs
2137
2129
} ]
2138
2130
} ;
2139
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
2140
2131
2141
2132
for htlc in self . pending_inbound_htlcs . iter_mut ( ) {
2142
2133
let new_forward = if let & InboundHTLCState :: RemoteAnnounced ( ref forward_info) = & htlc. state {
@@ -2356,7 +2347,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2356
2347
secret: msg. per_commitment_secret,
2357
2348
} ] ,
2358
2349
} ;
2359
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
2360
2350
2361
2351
// Update state now that we've passed all the can-fail calls...
2362
2352
// (note that we may still fail to generate the new commitment_signed message, but that's
@@ -3470,9 +3460,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3470
3460
if header. bitcoin_hash ( ) != self . last_block_connected {
3471
3461
self . last_block_connected = header. bitcoin_hash ( ) ;
3472
3462
self . update_time_counter = cmp:: max ( self . update_time_counter , header. time ) ;
3473
- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3474
- channel_monitor. last_block_hash = self . last_block_connected ;
3475
- }
3476
3463
if self . funding_tx_confirmations > 0 {
3477
3464
if self . funding_tx_confirmations == self . minimum_depth as u64 {
3478
3465
let need_commitment_update = if non_shutdown_state == ChannelState :: FundingSent as u32 {
@@ -3531,9 +3518,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3531
3518
self . funding_tx_confirmations = self . minimum_depth as u64 - 1 ;
3532
3519
}
3533
3520
self . last_block_connected = header. bitcoin_hash ( ) ;
3534
- if let Some ( channel_monitor) = self . channel_monitor . as_mut ( ) {
3535
- channel_monitor. last_block_hash = self . last_block_connected ;
3536
- }
3537
3521
false
3538
3522
}
3539
3523
@@ -3944,7 +3928,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3944
3928
their_revocation_point: self . their_cur_commitment_point. unwrap( )
3945
3929
} ]
3946
3930
} ;
3947
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
3948
3931
self . channel_state |= ChannelState :: AwaitingRemoteRevoke as u32 ;
3949
3932
Ok ( ( res, monitor_update) )
3950
3933
}
@@ -4323,8 +4306,6 @@ impl<ChanSigner: ChannelKeys + Writeable> Writeable for Channel<ChanSigner> {
4323
4306
self . their_shutdown_scriptpubkey . write ( writer) ?;
4324
4307
4325
4308
self . commitment_secrets . write ( writer) ?;
4326
-
4327
- self . channel_monitor . as_ref ( ) . unwrap ( ) . write_for_disk ( writer) ?;
4328
4309
Ok ( ( ) )
4329
4310
}
4330
4311
}
@@ -4492,13 +4473,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
4492
4473
let their_shutdown_scriptpubkey = Readable :: read ( reader) ?;
4493
4474
let commitment_secrets = Readable :: read ( reader) ?;
4494
4475
4495
- let ( monitor_last_block, channel_monitor) = Readable :: read ( reader) ?;
4496
- // We drop the ChannelMonitor's last block connected hash cause we don't actually bother
4497
- // doing full block connection operations on the internal ChannelMonitor copies
4498
- if monitor_last_block != last_block_connected {
4499
- return Err ( DecodeError :: InvalidValue ) ;
4500
- }
4501
-
4502
4476
Ok ( Channel {
4503
4477
user_id,
4504
4478
@@ -4571,7 +4545,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
4571
4545
4572
4546
their_shutdown_scriptpubkey,
4573
4547
4574
- channel_monitor : Some ( channel_monitor) ,
4575
4548
commitment_secrets,
4576
4549
4577
4550
network_sync : UpdateStatus :: Fresh ,
0 commit comments