@@ -3453,6 +3453,24 @@ 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+ /// Unsets the existing funding information.
3457+ ///
3458+ /// This must only be used if the channel has not yet completed funding and has not been used.
3459+ ///
3460+ /// Further, the channel must be immediately shut down after this with a call to
3461+ /// [`ChannelContext::force_shutdown`].
3462+ pub fn unset_funding_info(&mut self, funding: &mut FundingScope) {
3463+ debug_assert!(
3464+ matches!(self.channel_state, ChannelState::FundingNegotiated)
3465+ || matches!(self.channel_state, ChannelState::AwaitingChannelReady(_))
3466+ );
3467+ funding.channel_transaction_parameters.funding_outpoint = None;
3468+ self.channel_id = self.temporary_channel_id.expect(
3469+ "temporary_channel_id should be set since unset_funding_info is only called on funded \
3470+ channels that were unfunded immediately beforehand"
3471+ );
3472+ }
3473+
34563474 /// Transaction nomenclature is somewhat confusing here as there are many different cases - a
34573475 /// transaction is referred to as "a's transaction" implying that a will be able to broadcast
34583476 /// the transaction. Thus, b will generally be sending a signature over such a transaction to
@@ -5165,23 +5183,6 @@ impl<SP: Deref> FundedChannel<SP> where
51655183 self.context.channel_state.clear_waiting_for_batch();
51665184 }
51675185
5168- /// Unsets the existing funding information.
5169- ///
5170- /// This must only be used if the channel has not yet completed funding and has not been used.
5171- ///
5172- /// Further, the channel must be immediately shut down after this with a call to
5173- /// [`ChannelContext::force_shutdown`].
5174- 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- );
5183- }
5184-
51855186 /// Handles a channel_ready message from our peer. If we've already sent our channel_ready
51865187 /// and the channel is now usable (and public), this may generate an announcement_signatures to
51875188 /// reply with.
0 commit comments