Skip to content

Commit a0346b6

Browse files
committed
Move PendingSpliceInfoPre to Channel (from ChannelContext)
1 parent 508c1b6 commit a0346b6

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lightning/src/ln/channel.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,10 +1245,6 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
12451245
secp_ctx: Secp256k1<secp256k1::All>,
12461246
channel_value_satoshis: u64,
12471247

1248-
/// Info about an in-progress, pending splice (if any), on the pre-splice channel
1249-
#[cfg(splicing)]
1250-
pending_splice_pre: Option<PendingSpliceInfoPre>,
1251-
12521248
latest_monitor_update_id: u64,
12531249

12541250
holder_signer: ChannelSignerType<SP>,
@@ -2370,9 +2366,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23702366
is_manual_broadcast: false,
23712367

23722368
next_funding_txid: None,
2373-
2374-
#[cfg(splicing)]
2375-
pending_splice_pre: None,
23762369
};
23772370

23782371
Ok(channel_context)
@@ -2603,9 +2596,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
26032596
local_initiated_shutdown: None,
26042597
is_manual_broadcast: false,
26052598
next_funding_txid: None,
2606-
2607-
#[cfg(splicing)]
2608-
pending_splice_pre: None,
26092599
})
26102600
}
26112601

@@ -4437,6 +4427,9 @@ pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
44374427
pub context: ChannelContext<SP>,
44384428
pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
44394429
holder_commitment_point: HolderCommitmentPoint,
4430+
/// Info about an in-progress, pending splice (if any), on the pre-splice channel
4431+
#[cfg(splicing)]
4432+
pending_splice_pre: Option<PendingSpliceInfoPre>,
44404433
}
44414434

44424435
#[cfg(any(test, fuzzing))]
@@ -8055,7 +8048,7 @@ impl<SP: Deref> Channel<SP> where
80558048
) -> Result<msgs::SpliceInit, ChannelError> {
80568049
// Check if a splice has been initiated already.
80578050
// Note: this could be handled more nicely, and support multiple outstanding splice's, the incoming splice_ack matters anyways.
8058-
if let Some(splice_info) = &self.context.pending_splice_pre {
8051+
if let Some(splice_info) = &self.pending_splice_pre {
80598052
return Err(ChannelError::Warn(format!(
80608053
"Channel has already a splice pending, contribution {}", splice_info.our_funding_contribution
80618054
)));
@@ -8084,7 +8077,7 @@ impl<SP: Deref> Channel<SP> where
80848077
// Note: post-splice channel value is not yet known at this point, counterpary contribution is not known
80858078
// (Cannot test for miminum required post-splice channel value)
80868079

8087-
self.context.pending_splice_pre = Some(PendingSpliceInfoPre {
8080+
self.pending_splice_pre = Some(PendingSpliceInfoPre {
80888081
our_funding_contribution: our_funding_contribution_satoshis,
80898082
});
80908083

@@ -8101,7 +8094,7 @@ impl<SP: Deref> Channel<SP> where
81018094

81028095
// Check if a splice has been initiated already.
81038096
// Note: this could be handled more nicely, and support multiple outstanding splice's, the incoming splice_ack matters anyways.
8104-
if let Some(splice_info) = &self.context.pending_splice_pre {
8097+
if let Some(splice_info) = &self.pending_splice_pre {
81058098
return Err(ChannelError::Warn(format!(
81068099
"Channel has already a splice pending, contribution {}", splice_info.our_funding_contribution,
81078100
)));
@@ -8150,7 +8143,7 @@ impl<SP: Deref> Channel<SP> where
81508143
let their_funding_contribution_satoshis = msg.funding_contribution_satoshis;
81518144

81528145
// check if splice is pending
8153-
let pending_splice = if let Some(pending_splice) = &self.context.pending_splice_pre {
8146+
let pending_splice = if let Some(pending_splice) = &self.pending_splice_pre {
81548147
pending_splice
81558148
} else {
81568149
return Err(ChannelError::Warn(format!("Channel is not in pending splice")));
@@ -8860,6 +8853,8 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
88608853
context: self.context,
88618854
interactive_tx_signing_session: None,
88628855
holder_commitment_point,
8856+
#[cfg(splicing)]
8857+
pending_splice_pre: None,
88638858
};
88648859

88658860
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some()
@@ -9125,6 +9120,8 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
91259120
context: self.context,
91269121
interactive_tx_signing_session: None,
91279122
holder_commitment_point,
9123+
#[cfg(splicing)]
9124+
pending_splice_pre: None,
91289125
};
91299126
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some()
91309127
|| channel.context.signer_pending_channel_ready;
@@ -9300,6 +9297,8 @@ impl<SP: Deref> OutboundV2Channel<SP> where SP::Target: SignerProvider {
93009297
context: self.context,
93019298
interactive_tx_signing_session: Some(signing_session),
93029299
holder_commitment_point,
9300+
#[cfg(splicing)]
9301+
pending_splice_pre: None,
93039302
};
93049303

93059304
Ok(channel)
@@ -9506,6 +9505,8 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
95069505
context: self.context,
95079506
interactive_tx_signing_session: Some(signing_session),
95089507
holder_commitment_point,
9508+
#[cfg(splicing)]
9509+
pending_splice_pre: None,
95099510
};
95109511

95119512
Ok(channel)
@@ -10583,12 +10584,11 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1058310584
// during a signing session, but have not received `tx_signatures` we MUST set `next_funding_txid`
1058410585
// to the txid of that interactive transaction, else we MUST NOT set it.
1058510586
next_funding_txid: None,
10586-
10587-
#[cfg(splicing)]
10588-
pending_splice_pre: None,
1058910587
},
1059010588
interactive_tx_signing_session: None,
1059110589
holder_commitment_point,
10590+
#[cfg(splicing)]
10591+
pending_splice_pre: None,
1059210592
})
1059310593
}
1059410594
}

0 commit comments

Comments
 (0)