@@ -1353,10 +1353,13 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
13531353 // *we* sign a holder commitment transaction, not when e.g. a watchtower broadcasts one of our
13541354 // holder commitment transactions.
13551355 if self . broadcasted_holder_revokable_script . is_some ( ) {
1356- let ( claim_reqs, _) = self . get_broadcasted_holder_claims ( & self . current_holder_commitment_tx , 0 ) ;
1356+ // Assume that the broadcasted commitment transaction confirmed in the current best
1357+ // block. Even if not, its a reasonable metric for the bump criteria on the HTLC
1358+ // transactions.
1359+ let ( claim_reqs, _) = self . get_broadcasted_holder_claims ( & self . current_holder_commitment_tx , self . best_block . height ( ) ) ;
13571360 self . onchain_tx_handler . update_claims_view ( & Vec :: new ( ) , claim_reqs, self . best_block . height ( ) , self . best_block . height ( ) , broadcaster, fee_estimator, logger) ;
13581361 if let Some ( ref tx) = self . prev_holder_signed_commitment_tx {
1359- let ( claim_reqs, _) = self . get_broadcasted_holder_claims ( & tx, 0 ) ;
1362+ let ( claim_reqs, _) = self . get_broadcasted_holder_claims ( & tx, self . best_block . height ( ) ) ;
13601363 self . onchain_tx_handler . update_claims_view ( & Vec :: new ( ) , claim_reqs, self . best_block . height ( ) , self . best_block . height ( ) , broadcaster, fee_estimator, logger) ;
13611364 }
13621365 }
@@ -1724,7 +1727,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17241727 // Returns (1) `PackageTemplate`s that can be given to the OnChainTxHandler, so that the handler can
17251728 // broadcast transactions claiming holder HTLC commitment outputs and (2) a holder revokable
17261729 // script so we can detect whether a holder transaction has been seen on-chain.
1727- fn get_broadcasted_holder_claims ( & self , holder_tx : & HolderSignedTx , height : u32 ) -> ( Vec < PackageTemplate > , Option < ( Script , PublicKey , PublicKey ) > ) {
1730+ fn get_broadcasted_holder_claims ( & self , holder_tx : & HolderSignedTx , conf_height : u32 ) -> ( Vec < PackageTemplate > , Option < ( Script , PublicKey , PublicKey ) > ) {
17281731 let mut claim_requests = Vec :: with_capacity ( holder_tx. htlc_outputs . len ( ) ) ;
17291732
17301733 let redeemscript = chan_utils:: get_revokeable_redeemscript ( & holder_tx. revocation_key , self . on_holder_tx_csv , & holder_tx. delayed_payment_key ) ;
@@ -1743,7 +1746,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17431746 } ;
17441747 HolderHTLCOutput :: build_accepted ( payment_preimage, htlc. amount_msat )
17451748 } ;
1746- let htlc_package = PackageTemplate :: build_package ( holder_tx. txid , transaction_output_index, PackageSolvingData :: HolderHTLCOutput ( htlc_output) , height , false , height ) ;
1749+ let htlc_package = PackageTemplate :: build_package ( holder_tx. txid , transaction_output_index, PackageSolvingData :: HolderHTLCOutput ( htlc_output) , htlc . cltv_expiry , false , conf_height ) ;
17471750 claim_requests. push ( htlc_package) ;
17481751 }
17491752 }
@@ -2043,6 +2046,9 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
20432046 self . pending_monitor_events . push ( MonitorEvent :: CommitmentTxBroadcasted ( self . funding_info . 0 ) ) ;
20442047 let commitment_tx = self . onchain_tx_handler . get_fully_signed_holder_tx ( & self . funding_redeemscript ) ;
20452048 self . holder_tx_signed = true ;
2049+ // Because we're broadcasting a commitment transaction, we should construct the package
2050+ // assuming it gets confirmed in the next block. Sadly, we have code which considers
2051+ // "not yet confirmed" things as discardable, so we cannot do that here.
20462052 let ( mut new_outpoints, _) = self . get_broadcasted_holder_claims ( & self . current_holder_commitment_tx , self . best_block . height ( ) ) ;
20472053 let new_outputs = self . get_broadcasted_holder_watch_outputs ( & self . current_holder_commitment_tx , & commitment_tx) ;
20482054 if !new_outputs. is_empty ( ) {
0 commit comments