@@ -5501,16 +5501,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
55015501 }
55025502
55035503 if should_broadcast_commitment {
5504- // Only generate claims immediately if block_confirmed
5505- // won't also generate them to avoid duplicate registrations.
5506- let should_broadcast = self . should_broadcast_holder_commitment_txn ( logger) ;
5507- if should_broadcast. is_none ( ) {
5508- let ( mut claimables, mut outputs) =
5509- self . generate_claimable_outpoints_and_watch_outputs ( None ) ;
5510- if !self . is_manual_broadcast || self . funding_seen_onchain {
5511- claimable_outpoints. append ( & mut claimables) ;
5512- watch_outputs. append ( & mut outputs) ;
5513- }
5504+ let ( mut claimables, mut outputs) =
5505+ self . generate_claimable_outpoints_and_watch_outputs ( None ) ;
5506+ if !self . is_manual_broadcast || self . funding_seen_onchain {
5507+ claimable_outpoints. append ( & mut claimables) ;
5508+ watch_outputs. append ( & mut outputs) ;
55145509 }
55155510 }
55165511
@@ -5545,14 +5540,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
55455540 log_trace ! ( logger, "Processing {} matched transactions for block at height {}." , txn_matched. len( ) , conf_height) ;
55465541 debug_assert ! ( self . best_block. height >= conf_height) ;
55475542
5548- let should_broadcast = self . should_broadcast_holder_commitment_txn ( logger) ;
5549- if let Some ( payment_hash) = should_broadcast {
5550- let reason = ClosureReason :: HTLCsTimedOut { payment_hash : Some ( payment_hash) } ;
5551- let ( mut new_outpoints, mut new_outputs) =
5552- self . generate_claimable_outpoints_and_watch_outputs ( Some ( reason) ) ;
5553- if !self . is_manual_broadcast || self . funding_seen_onchain {
5554- claimable_outpoints. append ( & mut new_outpoints) ;
5555- watch_outputs. append ( & mut new_outputs) ;
5543+ // Only generate claims if we haven't already done so (e.g., in transactions_confirmed).
5544+ if claimable_outpoints. is_empty ( ) && watch_outputs. is_empty ( ) {
5545+ let should_broadcast = self . should_broadcast_holder_commitment_txn ( logger) ;
5546+ if let Some ( payment_hash) = should_broadcast {
5547+ let reason = ClosureReason :: HTLCsTimedOut { payment_hash : Some ( payment_hash) } ;
5548+ let ( mut new_outpoints, mut new_outputs) =
5549+ self . generate_claimable_outpoints_and_watch_outputs ( Some ( reason) ) ;
5550+ if !self . is_manual_broadcast || self . funding_seen_onchain {
5551+ claimable_outpoints. append ( & mut new_outpoints) ;
5552+ watch_outputs. append ( & mut new_outputs) ;
5553+ }
55565554 }
55575555 }
55585556
0 commit comments