@@ -385,9 +385,6 @@ pub(super) struct Channel<ChanSigner: ChannelKeys> {
385
385
386
386
their_shutdown_scriptpubkey : Option < Script > ,
387
387
388
- /// Used exclusively to broadcast the latest local state, mostly a historical quirk that this
389
- /// is here:
390
- channel_monitor : Option < ChannelMonitor < ChanSigner > > ,
391
388
commitment_secrets : CounterpartyCommitmentSecrets ,
392
389
393
390
network_sync : UpdateStatus ,
@@ -557,7 +554,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
557
554
558
555
their_shutdown_scriptpubkey : None ,
559
556
560
- channel_monitor : None ,
561
557
commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
562
558
563
559
network_sync : UpdateStatus :: Fresh ,
@@ -787,7 +783,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
787
783
788
784
their_shutdown_scriptpubkey,
789
785
790
- channel_monitor : None ,
791
786
commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
792
787
793
788
network_sync : UpdateStatus :: Fresh ,
@@ -1289,7 +1284,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1289
1284
payment_preimage: payment_preimage_arg. clone( ) ,
1290
1285
} ] ,
1291
1286
} ;
1292
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
1293
1287
1294
1288
if ( self . channel_state & ( ChannelState :: AwaitingRemoteRevoke as u32 | ChannelState :: PeerDisconnected as u32 | ChannelState :: MonitorUpdateFailed as u32 ) ) != 0 {
1295
1289
for pending_update in self . holding_cell_htlc_updates . iter ( ) {
@@ -1619,7 +1613,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1619
1613
} }
1620
1614
}
1621
1615
1622
- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
1623
1616
let channel_monitor = create_monitor ! ( ) ;
1624
1617
1625
1618
self . channel_state = ChannelState :: FundingSent as u32 ;
@@ -1685,7 +1678,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1685
1678
} }
1686
1679
}
1687
1680
1688
- self . channel_monitor = Some ( create_monitor ! ( ) ) ;
1689
1681
let channel_monitor = create_monitor ! ( ) ;
1690
1682
1691
1683
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> {
2138
2130
htlc_outputs: htlcs_and_sigs
2139
2131
} ]
2140
2132
} ;
2141
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
2142
2133
2143
2134
for htlc in self . pending_inbound_htlcs . iter_mut ( ) {
2144
2135
let new_forward = if let & InboundHTLCState :: RemoteAnnounced ( ref forward_info) = & htlc. state {
@@ -2358,7 +2349,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2358
2349
secret: msg. per_commitment_secret,
2359
2350
} ] ,
2360
2351
} ;
2361
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
2362
2352
2363
2353
// Update state now that we've passed all the can-fail calls...
2364
2354
// (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> {
3466
3456
if header. bitcoin_hash ( ) != self . last_block_connected {
3467
3457
self . last_block_connected = header. bitcoin_hash ( ) ;
3468
3458
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
- }
3472
3459
if self . funding_tx_confirmations > 0 {
3473
3460
if self . funding_tx_confirmations == self . minimum_depth as u64 {
3474
3461
let need_commitment_update = if non_shutdown_state == ChannelState :: FundingSent as u32 {
@@ -3527,9 +3514,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3527
3514
self . funding_tx_confirmations = self . minimum_depth as u64 - 1 ;
3528
3515
}
3529
3516
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
- }
3533
3517
false
3534
3518
}
3535
3519
@@ -3940,7 +3924,6 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3940
3924
their_revocation_point: self . their_cur_commitment_point. unwrap( )
3941
3925
} ]
3942
3926
} ;
3943
- self . channel_monitor . as_mut ( ) . unwrap ( ) . update_monitor_ooo ( monitor_update. clone ( ) , logger) . unwrap ( ) ;
3944
3927
self . channel_state |= ChannelState :: AwaitingRemoteRevoke as u32 ;
3945
3928
Ok ( ( res, monitor_update) )
3946
3929
}
@@ -4317,8 +4300,6 @@ impl<ChanSigner: ChannelKeys + Writeable> Writeable for Channel<ChanSigner> {
4317
4300
self . their_shutdown_scriptpubkey . write ( writer) ?;
4318
4301
4319
4302
self . commitment_secrets . write ( writer) ?;
4320
-
4321
- self . channel_monitor . as_ref ( ) . unwrap ( ) . write_for_disk ( writer) ?;
4322
4303
Ok ( ( ) )
4323
4304
}
4324
4305
}
@@ -4485,13 +4466,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
4485
4466
let their_shutdown_scriptpubkey = Readable :: read ( reader) ?;
4486
4467
let commitment_secrets = Readable :: read ( reader) ?;
4487
4468
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
-
4495
4469
Ok ( Channel {
4496
4470
user_id,
4497
4471
@@ -4564,7 +4538,6 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for Channel<ChanSigner> {
4564
4538
4565
4539
their_shutdown_scriptpubkey,
4566
4540
4567
- channel_monitor : Some ( channel_monitor) ,
4568
4541
commitment_secrets,
4569
4542
4570
4543
network_sync : UpdateStatus :: Fresh ,
0 commit comments