@@ -3453,6 +3453,18 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3453
3453
!matches!(self.channel_state, ChannelState::AwaitingChannelReady(flags) if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH))
3454
3454
}
3455
3455
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
+
3456
3468
/// Transaction nomenclature is somewhat confusing here as there are many different cases - a
3457
3469
/// transaction is referred to as "a's transaction" implying that a will be able to broadcast
3458
3470
/// 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
5172
5184
/// Further, the channel must be immediately shut down after this with a call to
5173
5185
/// [`ChannelContext::force_shutdown`].
5174
5186
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);
5183
5188
}
5184
5189
5185
5190
/// 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 {
9276
9281
} else { None };
9277
9282
(open_channel, funding_created)
9278
9283
}
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
+ }
9279
9292
}
9280
9293
9281
9294
/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
0 commit comments