Remove their_funding_contribution_satoshis from FundingNegotiationContext
What changed, and why it matters
This commit removes an unused field that tracked how much money the other party was putting into a channel. The field was marked as dead code and only relevant for future dual-funding/splicing features. The commit message says the value is no longer needed because it has already been used to create a FundingScope. There is no indication of a security bug being fixed.
No security action required. Treat as normal code-cleanup review; verify downstream consumers of FundingNegotiationContext do not reference the removed field (the diff suggests none do).
Security signals we found
No security-relevant signals present in commit or diff
Change is a dead-code removal / data-structure simplification
No validation, cryptographic, or state-machine logic modified
Evidence from the diff
The patch deletes their_funding_contribution_satoshis from FundingNegotiationContext and removes all assignments to it across channel opening, splicing, and test code. The field was guarded by #[allow(dead_code)] with a TODO for dual-funding/splicing. The change is purely a code cleanup/refactoring; no logic that consumes the field appears to remain, and no bounds checks or validation behavior is altered.
Changed components
lightning/src/ln/channel.rslightning/src/ln/interactivetxs.rsInspect captured patch +0 / −10
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index 4d675f9..1d6dae7 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -5968,9 +5968,6 @@ pub(super) struct FundingNegotiationContext {
pub is_initiator: bool,
/// The amount in satoshis we will be contributing to the channel.
pub our_funding_contribution: SignedAmount,
- /// The amount in satoshis our counterparty will be contributing to the channel.
- #[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled.
- pub their_funding_contribution_satoshis: Option<i64>,
/// The funding transaction locktime suggested by the initiator. If set by us, it is always set
/// to the current block height to align incentives against fee-sniping.
pub funding_tx_locktime: LockTime,
@@ -10684,7 +10681,6 @@ where
let funding_negotiation_context = FundingNegotiationContext {
is_initiator: true,
our_funding_contribution,
- their_funding_contribution_satoshis: None,
funding_tx_locktime: LockTime::from_consensus(locktime),
funding_feerate_sat_per_1000_weight: funding_feerate_per_kw,
shared_funding_input: Some(prev_funding_input),
@@ -10805,12 +10801,10 @@ where
self.funding.get_value_satoshis(),
);
- let their_funding_contribution_satoshis = msg.funding_contribution_satoshis;
let prev_funding_input = self.funding.to_splice_funding_input();
let funding_negotiation_context = FundingNegotiationContext {
is_initiator: false,
our_funding_contribution,
- their_funding_contribution_satoshis: Some(their_funding_contribution_satoshis),
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
funding_feerate_sat_per_1000_weight: msg.funding_feerate_per_kw,
shared_funding_input: Some(prev_funding_input),
@@ -12509,8 +12503,6 @@ where
let funding_negotiation_context = FundingNegotiationContext {
is_initiator: true,
our_funding_contribution: SignedAmount::from_sat(funding_satoshis as i64),
- // TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
- their_funding_contribution_satoshis: None,
funding_tx_locktime,
funding_feerate_sat_per_1000_weight,
shared_funding_input: None,
@@ -12665,7 +12657,6 @@ where
let funding_negotiation_context = FundingNegotiationContext {
is_initiator: false,
our_funding_contribution,
- their_funding_contribution_satoshis: Some(msg.common_fields.funding_satoshis as i64),
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
shared_funding_input: None,
diff --git a/lightning/src/ln/interactivetxs.rs b/lightning/src/ln/interactivetxs.rs
index c4d2ed9..9853528 100644
--- a/lightning/src/ln/interactivetxs.rs
+++ b/lightning/src/ln/interactivetxs.rs
@@ -3188,7 +3188,6 @@ mod tests {
let context = FundingNegotiationContext {
is_initiator: true,
our_funding_contribution: SignedAmount::from_sat(our_contributed as i64),
- their_funding_contribution_satoshis: None,
funding_tx_locktime: AbsoluteLockTime::ZERO,
funding_feerate_sat_per_1000_weight,
shared_funding_input: None,
Why this scored 13/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.