@@ -1969,21 +1969,19 @@ where
1969
1969
let logger = WithChannelContext::from(logger, self.context(), None);
1970
1970
match &mut self.phase {
1971
1971
ChannelPhase::UnfundedV2(chan) => {
1972
- let mut signing_session = chan
1972
+ let signing_session = chan
1973
1973
.interactive_tx_constructor
1974
1974
.take()
1975
1975
.expect("PendingV2Channel::interactive_tx_constructor should be set")
1976
1976
.into_signing_session();
1977
1977
let commitment_signed = chan.context.funding_tx_constructed(
1978
1978
&mut chan.funding,
1979
- &mut signing_session,
1979
+ signing_session,
1980
1980
false,
1981
1981
chan.unfunded_context.transaction_number(),
1982
1982
&&logger,
1983
1983
)?;
1984
1984
1985
- chan.interactive_tx_signing_session = Some(signing_session);
1986
-
1987
1985
return Ok(commitment_signed);
1988
1986
},
1989
1987
ChannelPhase::Funded(chan) => {
@@ -1994,17 +1992,15 @@ where
1994
1992
interactive_tx_constructor,
1995
1993
} = funding_negotiation
1996
1994
{
1997
- let mut signing_session =
1998
- interactive_tx_constructor.into_signing_session();
1995
+ let signing_session = interactive_tx_constructor.into_signing_session();
1999
1996
let commitment_signed = chan.context.funding_tx_constructed(
2000
1997
&mut funding,
2001
- &mut signing_session,
1998
+ signing_session,
2002
1999
true,
2003
2000
chan.holder_commitment_point.next_transaction_number(),
2004
2001
&&logger,
2005
2002
)?;
2006
2003
2007
- chan.interactive_tx_signing_session = Some(signing_session);
2008
2004
pending_splice.funding_negotiation =
2009
2005
Some(FundingNegotiation::AwaitingSignatures { funding });
2010
2006
@@ -2057,7 +2053,6 @@ where
2057
2053
let mut funded_channel = FundedChannel {
2058
2054
funding: chan.funding,
2059
2055
context: chan.context,
2060
- interactive_tx_signing_session: chan.interactive_tx_signing_session,
2061
2056
holder_commitment_point,
2062
2057
pending_splice: None,
2063
2058
quiescent_action: None,
@@ -2082,6 +2077,7 @@ where
2082
2077
.map(|funding_negotiation| funding_negotiation.as_funding().is_some())
2083
2078
.unwrap_or(false);
2084
2079
let session_received_commitment_signed = funded_channel
2080
+ .context
2085
2081
.interactive_tx_signing_session
2086
2082
.as_ref()
2087
2083
.map(|session| session.has_received_commitment_signed())
@@ -2993,6 +2989,16 @@ where
2993
2989
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
2994
2990
/// store it here and only release it to the `ChannelManager` once it asks for it.
2995
2991
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
2992
+
2993
+ /// The signing session for the current interactive tx construction, if any.
2994
+ ///
2995
+ /// This is populated when the interactive tx construction phase completes
2996
+ /// (i.e., upon receiving a consecutive `tx_complete`) and the channel enters
2997
+ /// the signing phase (`FundingNegotiated` state with the `INTERACTIVE_SIGNING` flag set).
2998
+ ///
2999
+ /// This field is cleared once our counterparty sends a `channel_ready` or upon splice funding
3000
+ /// promotion.
3001
+ pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
2996
3002
}
2997
3003
2998
3004
/// A channel struct implementing this trait can receive an initial counterparty commitment
@@ -3567,6 +3573,8 @@ where
3567
3573
blocked_monitor_updates: Vec::new(),
3568
3574
3569
3575
is_manual_broadcast: false,
3576
+
3577
+ interactive_tx_signing_session: None,
3570
3578
};
3571
3579
3572
3580
Ok((funding, channel_context))
@@ -3803,6 +3811,8 @@ where
3803
3811
blocked_monitor_updates: Vec::new(),
3804
3812
local_initiated_shutdown: None,
3805
3813
is_manual_broadcast: false,
3814
+
3815
+ interactive_tx_signing_session: None,
3806
3816
};
3807
3817
3808
3818
Ok((funding, channel_context))
@@ -6112,7 +6122,7 @@ where
6112
6122
6113
6123
#[rustfmt::skip]
6114
6124
fn funding_tx_constructed<L: Deref>(
6115
- &mut self, funding: &mut FundingScope, signing_session: &mut InteractiveTxSigningSession,
6125
+ &mut self, funding: &mut FundingScope, signing_session: InteractiveTxSigningSession,
6116
6126
is_splice: bool, holder_commitment_transaction_number: u64, logger: &L
6117
6127
) -> Result<msgs::CommitmentSigned, AbortReason>
6118
6128
where
@@ -6135,7 +6145,7 @@ where
6135
6145
};
6136
6146
funding
6137
6147
.channel_transaction_parameters.funding_outpoint = Some(outpoint);
6138
-
6148
+ self.interactive_tx_signing_session = Some(signing_session);
6139
6149
self.channel_state = ChannelState::FundingNegotiated(FundingNegotiatedFlags::new());
6140
6150
self.channel_state.set_interactive_signing();
6141
6151
@@ -6226,7 +6236,7 @@ where
6226
6236
}
6227
6237
6228
6238
fn get_initial_commitment_signed_v2<L: Deref>(
6229
- &mut self, funding: &FundingScope, logger: &L,
6239
+ &self, funding: &FundingScope, logger: &L,
6230
6240
) -> Option<msgs::CommitmentSigned>
6231
6241
where
6232
6242
SP::Target: SignerProvider,
@@ -6668,14 +6678,6 @@ where
6668
6678
{
6669
6679
pub funding: FundingScope,
6670
6680
pub context: ChannelContext<SP>,
6671
- /// The signing session for the current interactive tx construction, if any.
6672
- ///
6673
- /// This is populated when the interactive tx construction phase completes
6674
- /// (i.e., upon receiving a consecutive `tx_complete`) and the channel enters
6675
- /// the signing phase (`FundingNegotiated` state with the `INTERACTIVE_SIGNING` flag set).
6676
- ///
6677
- /// This field is cleared once our counterparty sends a `channel_ready`.
6678
- pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
6679
6681
holder_commitment_point: HolderCommitmentPoint,
6680
6682
6681
6683
/// Information about any pending splice candidates, including RBF attempts.
@@ -7408,8 +7410,7 @@ where
7408
7410
7409
7411
self.context.counterparty_current_commitment_point = self.context.counterparty_next_commitment_point;
7410
7412
self.context.counterparty_next_commitment_point = Some(msg.next_per_commitment_point);
7411
- // Clear any interactive signing session.
7412
- self.interactive_tx_signing_session = None;
7413
+ self.context.interactive_tx_signing_session = None;
7413
7414
7414
7415
log_info!(logger, "Received channel_ready from peer for channel {}", &self.context.channel_id());
7415
7416
@@ -7575,7 +7576,7 @@ where
7575
7576
log_info!(logger, "Received initial commitment_signed from peer for channel {}", &self.context.channel_id());
7576
7577
7577
7578
self.monitor_updating_paused(false, false, false, Vec::new(), Vec::new(), Vec::new());
7578
- self.interactive_tx_signing_session.as_mut().expect("signing session should be present").received_commitment_signed();
7579
+ self.context. interactive_tx_signing_session.as_mut().expect("signing session should be present").received_commitment_signed();
7579
7580
Ok(channel_monitor)
7580
7581
}
7581
7582
@@ -7668,7 +7669,8 @@ where
7668
7669
channel_id: Some(self.context.channel_id()),
7669
7670
};
7670
7671
7671
- self.interactive_tx_signing_session
7672
+ self.context
7673
+ .interactive_tx_signing_session
7672
7674
.as_mut()
7673
7675
.expect("Signing session must exist for negotiated pending splice")
7674
7676
.received_commitment_signed();
@@ -8615,6 +8617,7 @@ where
8615
8617
}
8616
8618
8617
8619
let (tx_signatures_opt, funding_tx_opt) = self
8620
+ .context
8618
8621
.interactive_tx_signing_session
8619
8622
.as_mut()
8620
8623
.ok_or_else(|| APIError::APIMisuseError {
@@ -8682,7 +8685,7 @@ where
8682
8685
return Err(ChannelError::Ignore("Ignoring tx_signatures received outside of interactive signing".to_owned()));
8683
8686
}
8684
8687
8685
- if let Some(ref mut signing_session) = self.interactive_tx_signing_session {
8688
+ if let Some(ref mut signing_session) = self.context. interactive_tx_signing_session {
8686
8689
if msg.tx_hash != signing_session.unsigned_tx().compute_txid() {
8687
8690
let msg = "The txid for the transaction does not match";
8688
8691
let reason = ClosureReason::ProcessingError { err: msg.to_owned() };
@@ -8955,7 +8958,7 @@ where
8955
8958
// An active interactive signing session or an awaiting channel_ready state implies that a
8956
8959
// commitment_signed retransmission is an initial one for funding negotiation. Thus, the
8957
8960
// signatures should be sent before channel_ready.
8958
- let channel_ready_order = if self.interactive_tx_signing_session.is_some() {
8961
+ let channel_ready_order = if self.context. interactive_tx_signing_session.is_some() {
8959
8962
ChannelReadyOrder::SignaturesFirst
8960
8963
} else if matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(_)) {
8961
8964
ChannelReadyOrder::SignaturesFirst
@@ -9463,7 +9466,7 @@ where
9463
9466
if let Some(next_funding) = &msg.next_funding {
9464
9467
// - if `next_funding` matches the latest interactive funding transaction
9465
9468
// or the current channel funding transaction:
9466
- if let Some(session) = &self.interactive_tx_signing_session {
9469
+ if let Some(session) = &self.context. interactive_tx_signing_session {
9467
9470
let our_next_funding_txid = session.unsigned_tx().compute_txid();
9468
9471
if our_next_funding_txid != next_funding.txid {
9469
9472
return Err(ChannelError::close(format!(
@@ -10763,7 +10766,7 @@ where
10763
10766
.collect::<Vec<_>>()
10764
10767
};
10765
10768
10766
- self.interactive_tx_signing_session = None;
10769
+ self.context. interactive_tx_signing_session = None;
10767
10770
self.pending_splice = None;
10768
10771
self.context.announcement_sigs = None;
10769
10772
self.context.announcement_sigs_state = AnnouncementSigsState::NotSent;
@@ -11320,7 +11323,7 @@ where
11320
11323
// Since we have a signing_session, this implies we've sent an initial `commitment_signed`...
11321
11324
if !self.context.channel_state.is_their_tx_signatures_sent() {
11322
11325
// ...but we didn't receive a `tx_signatures` from the counterparty yet.
11323
- self.interactive_tx_signing_session
11326
+ self.context. interactive_tx_signing_session
11324
11327
.as_ref()
11325
11328
.map(|signing_session| {
11326
11329
let mut next_funding = msgs::NextFunding {
@@ -11857,7 +11860,7 @@ where
11857
11860
})?;
11858
11861
let tx_msg_opt = interactive_tx_constructor.take_initiator_first_message();
11859
11862
11860
- debug_assert!(self.interactive_tx_signing_session.is_none());
11863
+ debug_assert!(self.context. interactive_tx_signing_session.is_none());
11861
11864
11862
11865
pending_splice.funding_negotiation = Some(FundingNegotiation::ConstructingTransaction {
11863
11866
funding: splice_funding,
@@ -13128,7 +13131,6 @@ where
13128
13131
let mut channel = FundedChannel {
13129
13132
funding: self.funding,
13130
13133
context: self.context,
13131
- interactive_tx_signing_session: None,
13132
13134
holder_commitment_point,
13133
13135
pending_splice: None,
13134
13136
quiescent_action: None,
@@ -13413,7 +13415,6 @@ where
13413
13415
let mut channel = FundedChannel {
13414
13416
funding: self.funding,
13415
13417
context: self.context,
13416
- interactive_tx_signing_session: None,
13417
13418
holder_commitment_point,
13418
13419
pending_splice: None,
13419
13420
quiescent_action: None,
@@ -13457,8 +13458,6 @@ where
13457
13458
pub funding_negotiation_context: FundingNegotiationContext,
13458
13459
/// The current interactive transaction construction session under negotiation.
13459
13460
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
13460
- /// The signing session created after `tx_complete` handling
13461
- pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
13462
13461
}
13463
13462
13464
13463
impl<SP: Deref> PendingV2Channel<SP>
@@ -13533,7 +13532,6 @@ where
13533
13532
unfunded_context,
13534
13533
funding_negotiation_context,
13535
13534
interactive_tx_constructor: None,
13536
- interactive_tx_signing_session: None,
13537
13535
};
13538
13536
Ok(chan)
13539
13537
}
@@ -13721,7 +13719,6 @@ where
13721
13719
context,
13722
13720
funding_negotiation_context,
13723
13721
interactive_tx_constructor,
13724
- interactive_tx_signing_session: None,
13725
13722
unfunded_context,
13726
13723
})
13727
13724
}
@@ -14328,7 +14325,7 @@ where
14328
14325
(53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
14329
14326
(55, removed_htlc_attribution_data, optional_vec), // Added in 0.2
14330
14327
(57, holding_cell_attribution_data, optional_vec), // Added in 0.2
14331
- (58, self.interactive_tx_signing_session, option), // Added in 0.2
14328
+ (58, self.context. interactive_tx_signing_session, option), // Added in 0.2
14332
14329
(59, self.funding.minimum_depth_override, option), // Added in 0.2
14333
14330
(60, self.context.historical_scids, optional_vec), // Added in 0.2
14334
14331
(61, fulfill_attribution_data, optional_vec), // Added in 0.2
@@ -15098,8 +15095,9 @@ where
15098
15095
15099
15096
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
15100
15097
is_manual_broadcast: is_manual_broadcast.unwrap_or(false),
15098
+
15099
+ interactive_tx_signing_session,
15101
15100
},
15102
- interactive_tx_signing_session,
15103
15101
holder_commitment_point,
15104
15102
pending_splice,
15105
15103
quiescent_action,
0 commit comments