@@ -1144,7 +1144,11 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1144
1144
1145
1145
/// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all
1146
1146
/// 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
+ {
1148
1152
self . payment_preimages . insert ( payment_hash. clone ( ) , payment_preimage. clone ( ) ) ;
1149
1153
}
1150
1154
@@ -1172,16 +1176,25 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1172
1176
for update in updates. updates . iter ( ) {
1173
1177
match update {
1174
1178
ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_tx, htlc_outputs } => {
1179
+ log_trace ! ( logger, "Updating ChannelMonitor with latest holder commitment transaction info" ) ;
1175
1180
if self . lockdown_from_offchain { panic ! ( ) ; }
1176
1181
self . provide_latest_holder_commitment_tx_info ( commitment_tx. clone ( ) , htlc_outputs. clone ( ) ) ?
1177
1182
} ,
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
+ } ,
1180
1187
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
+ } ,
1184
1196
ChannelMonitorUpdateStep :: ChannelForceClosed { should_broadcast } => {
1197
+ log_trace ! ( logger, "Updating ChannelMonitor: channel force closed, should broadcast: {}" , should_broadcast) ;
1185
1198
self . lockdown_from_offchain = true ;
1186
1199
if * should_broadcast {
1187
1200
self . broadcast_latest_holder_commitment_txn ( broadcaster, logger) ;
0 commit comments