@@ -5481,17 +5481,17 @@ impl<SP: Deref> Channel<SP> where
5481
5481
// If we're past (or at) the AwaitingChannelReady stage on an outbound channel, try to
5482
5482
// (re-)broadcast the funding transaction as we may have declined to broadcast it when we
5483
5483
// first received the funding_signed.
5484
- let mut funding_broadcastable =
5484
+ let mut funding_broadcastable = None;
5485
+ if let Some(funding_transaction) = &self.context.funding_transaction {
5485
5486
if self.context.is_outbound() &&
5486
5487
(matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if !flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH)) ||
5487
5488
matches!(self.context.channel_state, ChannelState::ChannelReady(_)))
5488
5489
{
5489
- self.context.funding_transaction.take()
5490
- } else { None };
5491
- // That said, if the funding transaction is already confirmed (ie we're active with a
5492
- // minimum_depth over 0) don't bother re-broadcasting the confirmed funding tx.
5493
- if matches!(self.context.channel_state, ChannelState::ChannelReady(_)) && self.context.minimum_depth != Some(0) {
5494
- funding_broadcastable = None;
5490
+ // Broadcast only if not yet confirmed
5491
+ if self.context.get_funding_tx_confirmation_height().is_none() {
5492
+ funding_broadcastable = Some(funding_transaction.clone())
5493
+ }
5494
+ }
5495
5495
}
5496
5496
5497
5497
// We will never broadcast the funding transaction when we're in MonitorUpdateInProgress
@@ -7893,6 +7893,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
7893
7893
self.context.minimum_depth = Some(COINBASE_MATURITY);
7894
7894
}
7895
7895
7896
+ debug_assert!(self.context.funding_transaction.is_none());
7896
7897
self.context.funding_transaction = Some(funding_transaction);
7897
7898
self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
7898
7899
0 commit comments