@@ -5495,17 +5495,17 @@ impl<SP: Deref> Channel<SP> where
5495
5495
// If we're past (or at) the AwaitingChannelReady stage on an outbound channel, try to
5496
5496
// (re-)broadcast the funding transaction as we may have declined to broadcast it when we
5497
5497
// first received the funding_signed.
5498
- let mut funding_broadcastable =
5498
+ let mut funding_broadcastable = None;
5499
+ if let Some(funding_transaction) = &self.context.funding_transaction {
5499
5500
if self.context.is_outbound() &&
5500
5501
(matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if !flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH)) ||
5501
5502
matches!(self.context.channel_state, ChannelState::ChannelReady(_)))
5502
5503
{
5503
- self.context.funding_transaction.take()
5504
- } else { None };
5505
- // That said, if the funding transaction is already confirmed (ie we're active with a
5506
- // minimum_depth over 0) don't bother re-broadcasting the confirmed funding tx.
5507
- if matches!(self.context.channel_state, ChannelState::ChannelReady(_)) && self.context.minimum_depth != Some(0) {
5508
- funding_broadcastable = None;
5504
+ // Broadcast only if not yet confirmed
5505
+ if self.context.get_funding_tx_confirmation_height().is_none() {
5506
+ funding_broadcastable = Some(funding_transaction.clone())
5507
+ }
5508
+ }
5509
5509
}
5510
5510
5511
5511
// We will never broadcast the funding transaction when we're in MonitorUpdateInProgress
@@ -7907,6 +7907,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
7907
7907
self.context.minimum_depth = Some(COINBASE_MATURITY);
7908
7908
}
7909
7909
7910
+ debug_assert!(self.context.funding_transaction.is_none());
7910
7911
self.context.funding_transaction = Some(funding_transaction);
7911
7912
self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
7912
7913
0 commit comments