@@ -5497,8 +5497,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
5497
5497
if should_broadcast_commitment {
5498
5498
let ( mut claimables, mut outputs) =
5499
5499
self . generate_claimable_outpoints_and_watch_outputs ( None ) ;
5500
- claimable_outpoints. append ( & mut claimables) ;
5501
- watch_outputs. append ( & mut outputs) ;
5500
+ if !self . is_manual_broadcast || self . funding_seen_onchain {
5501
+ claimable_outpoints. append ( & mut claimables) ;
5502
+ watch_outputs. append ( & mut outputs) ;
5503
+ }
5502
5504
}
5503
5505
5504
5506
self . block_confirmed ( height, block_hash, txn_matched, watch_outputs, claimable_outpoints, & broadcaster, & fee_estimator, logger)
@@ -5532,13 +5534,18 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
5532
5534
log_trace ! ( logger, "Processing {} matched transactions for block at height {}." , txn_matched. len( ) , conf_height) ;
5533
5535
debug_assert ! ( self . best_block. height >= conf_height) ;
5534
5536
5535
- let should_broadcast = self . should_broadcast_holder_commitment_txn ( logger) ;
5536
- if let Some ( payment_hash) = should_broadcast {
5537
- let reason = ClosureReason :: HTLCsTimedOut { payment_hash : Some ( payment_hash) } ;
5538
- let ( mut new_outpoints, mut new_outputs) =
5539
- self . generate_claimable_outpoints_and_watch_outputs ( Some ( reason) ) ;
5540
- claimable_outpoints. append ( & mut new_outpoints) ;
5541
- watch_outputs. append ( & mut new_outputs) ;
5537
+ // Only generate claims if we haven't already done so (e.g., in transactions_confirmed).
5538
+ if claimable_outpoints. is_empty ( ) {
5539
+ let should_broadcast = self . should_broadcast_holder_commitment_txn ( logger) ;
5540
+ if let Some ( payment_hash) = should_broadcast {
5541
+ let reason = ClosureReason :: HTLCsTimedOut { payment_hash : Some ( payment_hash) } ;
5542
+ let ( mut new_outpoints, mut new_outputs) =
5543
+ self . generate_claimable_outpoints_and_watch_outputs ( Some ( reason) ) ;
5544
+ if !self . is_manual_broadcast || self . funding_seen_onchain {
5545
+ claimable_outpoints. append ( & mut new_outpoints) ;
5546
+ watch_outputs. append ( & mut new_outputs) ;
5547
+ }
5548
+ }
5542
5549
}
5543
5550
5544
5551
// Find which on-chain events have reached their confirmation threshold.
0 commit comments