@@ -1144,7 +1144,11 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
11441144
11451145 /// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all
11461146 /// commitment_tx_infos which contain the payment hash have been revoked.
1147- pub ( crate ) fn provide_payment_preimage ( & mut self , payment_hash : & PaymentHash , payment_preimage : & PaymentPreimage ) {
1147+ pub ( crate ) fn provide_payment_preimage < B : Deref , F : Deref , L : Deref > ( & mut self , payment_hash : & PaymentHash , payment_preimage : & PaymentPreimage , broadcaster : & B , fee_estimator : & F , logger : & L )
1148+ where B :: Target : BroadcasterInterface ,
1149+ F :: Target : FeeEstimator ,
1150+ L :: Target : Logger ,
1151+ {
11481152 self . payment_preimages . insert ( payment_hash. clone ( ) , payment_preimage. clone ( ) ) ;
11491153 }
11501154
@@ -1172,16 +1176,25 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
11721176 for update in updates. updates . iter ( ) {
11731177 match update {
11741178 ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_tx, htlc_outputs } => {
1179+ log_trace ! ( logger, "Updating ChannelMonitor with latest holder commitment transaction info" ) ;
11751180 if self . lockdown_from_offchain { panic ! ( ) ; }
11761181 self . provide_latest_holder_commitment_tx_info ( commitment_tx. clone ( ) , htlc_outputs. clone ( ) ) ?
11771182 } ,
1178- ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { unsigned_commitment_tx, htlc_outputs, commitment_number, their_revocation_point } =>
1179- self . provide_latest_counterparty_commitment_tx_info ( & unsigned_commitment_tx, htlc_outputs. clone ( ) , * commitment_number, * their_revocation_point, logger) ,
1183+ ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { unsigned_commitment_tx, htlc_outputs, commitment_number, their_revocation_point } => {
1184+ log_trace ! ( logger, "Updating ChannelMonitor with latest counterparty commitment transaction info" ) ;
1185+ self . provide_latest_counterparty_commitment_tx_info ( & unsigned_commitment_tx, htlc_outputs. clone ( ) , * commitment_number, * their_revocation_point, logger)
1186+ } ,
11801187 ChannelMonitorUpdateStep :: PaymentPreimage { payment_preimage } =>
1181- self . provide_payment_preimage ( & PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 [ ..] ) . into_inner ( ) ) , & payment_preimage) ,
1182- ChannelMonitorUpdateStep :: CommitmentSecret { idx, secret } =>
1183- self . provide_secret ( * idx, * secret) ?,
1188+ {
1189+ log_trace ! ( logger, "Updating ChannelMonitor with payment preimage" ) ;
1190+ self . provide_payment_preimage ( & PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 [ ..] ) . into_inner ( ) ) , & payment_preimage, broadcaster, fee_estimator, logger)
1191+ } ,
1192+ ChannelMonitorUpdateStep :: CommitmentSecret { idx, secret } => {
1193+ log_trace ! ( logger, "Updating ChannelMonitor with commitment secret" ) ;
1194+ self . provide_secret ( * idx, * secret) ?
1195+ } ,
11841196 ChannelMonitorUpdateStep :: ChannelForceClosed { should_broadcast } => {
1197+ log_trace ! ( logger, "Updating ChannelMonitor: channel force closed, should broadcast: {}" , should_broadcast) ;
11851198 self . lockdown_from_offchain = true ;
11861199 if * should_broadcast {
11871200 self . broadcast_latest_holder_commitment_txn ( broadcaster, logger) ;
0 commit comments