Skip to content

Commit cc4d2ac

Browse files
committed
Avoid bothering to prep for broadcast if we aren't gonna broadcast
In `generate_claimable_outpoints_and_watch_outputs` if we're going to decide to return nothing and defer broadcasting the commitment transaction, there's no need to prepare the broadcast tracking objects, so skip it.
1 parent c5ce61b commit cc4d2ac

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,6 +3961,13 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
39613961
// in the claim that is queued to OnchainTxHandler. We set holder_tx_signed here to reject
39623962
// new channel updates.
39633963
self.holder_tx_signed = true;
3964+
3965+
// In manual-broadcast mode, if we have not yet observed the funding transaction on-chain,
3966+
// return empty vectors rather than triggering a broadcast.
3967+
if require_funding_seen && self.is_manual_broadcast && !self.funding_seen_onchain {
3968+
return (Vec::new(), Vec::new());
3969+
}
3970+
39643971
let mut watch_outputs = Vec::new();
39653972
// In CSV anchor channels, we can't broadcast our HTLC transactions while the commitment transaction is
39663973
// unconfirmed.
@@ -3986,13 +3993,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
39863993
}
39873994
claimable_outpoints.append(&mut new_outpoints);
39883995
}
3989-
// In manual-broadcast mode, if we have not yet observed the funding transaction on-chain,
3990-
// return empty vectors.
3991-
if require_funding_seen && self.is_manual_broadcast && !self.funding_seen_onchain {
3992-
return (Vec::new(), Vec::new());
3993-
} else {
3994-
(claimable_outpoints, watch_outputs)
3995-
}
3996+
(claimable_outpoints, watch_outputs)
39963997
}
39973998

39983999
#[rustfmt::skip]

0 commit comments

Comments
 (0)