@@ -5481,17 +5481,17 @@ impl<SP: Deref> Channel<SP> where
54815481 // If we're past (or at) the AwaitingChannelReady stage on an outbound channel, try to
54825482 // (re-)broadcast the funding transaction as we may have declined to broadcast it when we
54835483 // 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 {
54855486 if self.context.is_outbound() &&
54865487 (matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if !flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH)) ||
54875488 matches!(self.context.channel_state, ChannelState::ChannelReady(_)))
54885489 {
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+ }
54955495 }
54965496
54975497 // 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 {
78937893 self.context.minimum_depth = Some(COINBASE_MATURITY);
78947894 }
78957895
7896+ debug_assert!(self.context.funding_transaction.is_none());
78967897 self.context.funding_transaction = Some(funding_transaction);
78977898 self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
78987899
0 commit comments