@@ -3453,6 +3453,18 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
34533453 !matches!(self.channel_state, ChannelState::AwaitingChannelReady(flags) if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH))
34543454 }
34553455
3456+ fn unset_funding_info(&mut self, funding: &mut FundingScope) {
3457+ debug_assert!(
3458+ matches!(self.channel_state, ChannelState::FundingNegotiated)
3459+ || matches!(self.channel_state, ChannelState::AwaitingChannelReady(_))
3460+ );
3461+ funding.channel_transaction_parameters.funding_outpoint = None;
3462+ self.channel_id = self.temporary_channel_id.expect(
3463+ "temporary_channel_id should be set since unset_funding_info is only called on funded \
3464+ channels that were unfunded immediately beforehand"
3465+ );
3466+ }
3467+
34563468 /// Transaction nomenclature is somewhat confusing here as there are many different cases - a
34573469 /// transaction is referred to as "a's transaction" implying that a will be able to broadcast
34583470 /// the transaction. Thus, b will generally be sending a signature over such a transaction to
@@ -5172,14 +5184,7 @@ impl<SP: Deref> FundedChannel<SP> where
51725184 /// Further, the channel must be immediately shut down after this with a call to
51735185 /// [`ChannelContext::force_shutdown`].
51745186 pub fn unset_funding_info(&mut self) {
5175- debug_assert!(matches!(
5176- self.context.channel_state, ChannelState::AwaitingChannelReady(_)
5177- ));
5178- self.funding.channel_transaction_parameters.funding_outpoint = None;
5179- self.context.channel_id = self.context.temporary_channel_id.expect(
5180- "temporary_channel_id should be set since unset_funding_info is only called on funded \
5181- channels that were unfunded immediately beforehand"
5182- );
5187+ self.context.unset_funding_info(&mut self.funding);
51835188 }
51845189
51855190 /// Handles a channel_ready message from our peer. If we've already sent our channel_ready
@@ -9276,6 +9281,14 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
92769281 } else { None };
92779282 (open_channel, funding_created)
92789283 }
9284+
9285+ /// Unsets the existing funding information.
9286+ ///
9287+ /// The channel must be immediately shut down after this with a call to
9288+ /// [`ChannelContext::force_shutdown`].
9289+ pub fn unset_funding_info(&mut self) {
9290+ self.context.unset_funding_info(&mut self.funding);
9291+ }
92799292}
92809293
92819294/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
0 commit comments