Rename PendingSplice::pending_funding to negotiated_candidates
What changed, and why it matters
This commit is a simple internal rename of a struct field from `pending_funding` to `negotiated_candidates` in the Lightning channel code. It does not change any behavior, logic, or security properties. The change is purely cosmetic to make the code easier to understand before a later refactor.
No action needed. This is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch renames the pending_funding field of PendingSplice to negotiated_candidates and updates all references in lightning/src/ln/channel.rs. It adds a doc comment explaining that the field holds FundingScopes that have been negotiated but not yet reached enough confirmations for both parties to exchange splice_locked. No functional changes are introduced.
Changed components
lightning/src/ln/channel.rsInspect captured patch +15 / −12
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index 1e7347d..82df0d2 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -2549,7 +2549,10 @@ impl AddSigned for u64 {
/// Info about a pending splice
struct PendingSplice {
funding_negotiation: Option<FundingNegotiation>,
- pending_funding: Vec<FundingScope>,
+
+ /// Funding candidates that have been negotiated but have not reached enough confirmations
+ /// by both counterparties to have exchanged `splice_locked` and be promoted.
+ negotiated_candidates: Vec<FundingScope>,
/// The funding txid used in the `splice_locked` sent to the counterparty.
sent_funding_txid: Option<Txid>,
@@ -2581,9 +2584,9 @@ impl PendingSplice {
where
SP::Target: SignerProvider,
{
- debug_assert!(confirmed_funding_index < self.pending_funding.len());
+ debug_assert!(confirmed_funding_index < self.negotiated_candidates.len());
- let funding = &self.pending_funding[confirmed_funding_index];
+ let funding = &self.negotiated_candidates[confirmed_funding_index];
if !context.check_funding_meets_minimum_depth(funding, height) {
return None;
}
@@ -6666,7 +6669,7 @@ macro_rules! promote_splice_funding {
// The swap above places the previous `FundingScope` into `pending_funding`.
let discarded_funding = $pending_splice
- .pending_funding
+ .negotiated_candidates
.drain(..)
.filter(|funding| funding.get_funding_txid() != prev_funding_txid)
.map(|mut funding| {
@@ -6803,7 +6806,7 @@ where
fn pending_funding(&self) -> &[FundingScope] {
if let Some(pending_splice) = &self.pending_splice {
- pending_splice.pending_funding.as_slice()
+ pending_splice.negotiated_candidates.as_slice()
} else {
&[]
}
@@ -6813,7 +6816,7 @@ where
core::iter::once(&mut self.funding).chain(
self.pending_splice
.as_mut()
- .map(|pending_splice| pending_splice.pending_funding.as_mut_slice())
+ .map(|pending_splice| pending_splice.negotiated_candidates.as_mut_slice())
.unwrap_or(&mut [])
.iter_mut(),
)
@@ -10716,7 +10719,7 @@ where
// Scope `funding` since it is swapped within `promote_splice_funding` and we don't want
// to unintentionally use it.
let funding = pending_splice
- .pending_funding
+ .negotiated_candidates
.iter_mut()
.find(|funding| funding.get_funding_txid() == Some(splice_txid))
.unwrap();
@@ -10791,7 +10794,7 @@ where
let mut confirmed_funding_index = None;
let mut funding_already_confirmed = false;
if let Some(pending_splice) = &mut self.pending_splice {
- for (index, funding) in pending_splice.pending_funding.iter_mut().enumerate() {
+ for (index, funding) in pending_splice.negotiated_candidates.iter_mut().enumerate() {
if self.context.check_for_funding_tx_confirmed(
funding, block_hash, height, index_in_block, &mut confirmed_tx, logger,
)? {
@@ -10963,7 +10966,7 @@ where
return Err(ClosureReason::ProcessingError { err });
},
};
- let funding = &mut pending_splice.pending_funding[confirmed_funding_index];
+ let funding = &mut pending_splice.negotiated_candidates[confirmed_funding_index];
// Check if the splice funding transaction was unconfirmed
if funding.get_funding_tx_confirmations(height) == 0 {
@@ -11542,7 +11545,7 @@ where
self.pending_splice = Some(PendingSplice {
funding_negotiation: Some(FundingNegotiation::AwaitingAck(funding_negotiation_context)),
- pending_funding: vec![],
+ negotiated_candidates: vec![],
sent_funding_txid: None,
received_funding_txid: None,
});
@@ -11765,7 +11768,7 @@ where
splice_funding,
interactive_tx_constructor,
)),
- pending_funding: Vec::new(),
+ negotiated_candidates: Vec::new(),
received_funding_txid: None,
sent_funding_txid: None,
});
@@ -11954,7 +11957,7 @@ where
};
if !pending_splice
- .pending_funding
+ .negotiated_candidates
.iter()
.any(|funding| funding.get_funding_txid() == Some(msg.splice_txid))
{
Why this scored 15/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.