@@ -5009,7 +5009,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
50095009 self.get_initial_counterparty_commitment_signature(funding, logger)
50105010 }
50115011
5012- fn check_funding_meets_minimum_depth(&self, funding: &mut FundingScope, height: u32) -> bool {
5012+ fn check_funding_meets_minimum_depth(&self, funding: &FundingScope, height: u32) -> bool {
50135013 let is_coinbase = funding
50145014 .funding_transaction
50155015 .as_ref()
@@ -5032,10 +5032,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
50325032 }
50335033
50345034 let funding_tx_confirmations = height as i64 - funding.funding_tx_confirmation_height as i64 + 1;
5035- if funding_tx_confirmations <= 0 {
5036- funding.funding_tx_confirmation_height = 0;
5037- }
5038-
50395035 if funding_tx_confirmations < minimum_depth.unwrap_or(0) as i64 {
50405036 return false;
50415037 }
@@ -8379,7 +8375,7 @@ impl<SP: Deref> FundedChannel<SP> where
83798375 // Called:
83808376 // * always when a new block/transactions are confirmed with the new height
83818377 // * when funding is signed with a height of 0
8382- if !self.context.check_funding_meets_minimum_depth(&mut self.funding, height) {
8378+ if !self.context.check_funding_meets_minimum_depth(&self.funding, height) {
83838379 return None;
83848380 }
83858381
@@ -8591,8 +8587,8 @@ impl<SP: Deref> FundedChannel<SP> where
85918587 self.context.channel_state.is_our_channel_ready() {
85928588 let mut funding_tx_confirmations = height as i64 - self.funding.funding_tx_confirmation_height as i64 + 1;
85938589 if self.funding.funding_tx_confirmation_height == 0 {
8594- // Note that check_get_channel_ready may reset funding_tx_confirmation_height to
8595- // zero if it has been reorged out, however in either case, our state flags
8590+ // Note that transaction_unconfirmed may have reset funding_tx_confirmation_height
8591+ // to zero if it has been reorged out, however in either case, our state flags
85968592 // indicate we've already sent a channel_ready
85978593 funding_tx_confirmations = 0;
85988594 }
@@ -8638,6 +8634,9 @@ impl<SP: Deref> FundedChannel<SP> where
86388634 // larger. If we don't know that time has moved forward, we can just set it to the last
86398635 // time we saw and it will be ignored.
86408636 let best_time = self.context.update_time_counter;
8637+
8638+ self.funding.funding_tx_confirmation_height = 0;
8639+
86418640 match self.do_best_block_updated(reorg_height, best_time, None::<(ChainHash, &&dyn NodeSigner, &UserConfig)>, logger) {
86428641 Ok((channel_ready, timed_out_htlcs, announcement_sigs)) => {
86438642 assert!(channel_ready.is_none(), "We can't generate a funding with 0 confirmations?");
0 commit comments