@@ -5501,16 +5501,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
5501
5501
}
5502
5502
5503
5503
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) ;
5514
5509
}
5515
5510
}
5516
5511
@@ -5545,14 +5540,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
5545
5540
log_trace ! ( logger, "Processing {} matched transactions for block at height {}." , txn_matched. len( ) , conf_height) ;
5546
5541
debug_assert ! ( self . best_block. height >= conf_height) ;
5547
5542
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
+ }
5556
5554
}
5557
5555
}
5558
5556
0 commit comments