Skip to content

Commit 2c7e49b

Browse files
committed
Rename PendingSplice::pending_funding to negotiated_candidates
An upcoming commit will rename PendingSplice to PendingFunding. Thus, rename the similarly named field to something more meaningful. It includes FundingScopes that have been negotiated but have not reached enough confirmations by both parties to have exchanged splice_locked.
1 parent 6349685 commit 2c7e49b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

lightning/src/ln/channel.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,7 +2549,10 @@ impl AddSigned for u64 {
25492549
/// Info about a pending splice
25502550
struct PendingSplice {
25512551
funding_negotiation: Option<FundingNegotiation>,
2552-
pending_funding: Vec<FundingScope>,
2552+
2553+
/// Funding candidates that have been negotiated but have not reached enough confirmations
2554+
/// by both counterparties to have exchanged `splice_locked` and be promoted.
2555+
negotiated_candidates: Vec<FundingScope>,
25532556

25542557
/// The funding txid used in the `splice_locked` sent to the counterparty.
25552558
sent_funding_txid: Option<Txid>,
@@ -2581,9 +2584,9 @@ impl PendingSplice {
25812584
where
25822585
SP::Target: SignerProvider,
25832586
{
2584-
debug_assert!(confirmed_funding_index < self.pending_funding.len());
2587+
debug_assert!(confirmed_funding_index < self.negotiated_candidates.len());
25852588

2586-
let funding = &self.pending_funding[confirmed_funding_index];
2589+
let funding = &self.negotiated_candidates[confirmed_funding_index];
25872590
if !context.check_funding_meets_minimum_depth(funding, height) {
25882591
return None;
25892592
}
@@ -6666,7 +6669,7 @@ macro_rules! promote_splice_funding {
66666669

66676670
// The swap above places the previous `FundingScope` into `pending_funding`.
66686671
let discarded_funding = $pending_splice
6669-
.pending_funding
6672+
.negotiated_candidates
66706673
.drain(..)
66716674
.filter(|funding| funding.get_funding_txid() != prev_funding_txid)
66726675
.map(|mut funding| {
@@ -6803,7 +6806,7 @@ where
68036806

68046807
fn pending_funding(&self) -> &[FundingScope] {
68056808
if let Some(pending_splice) = &self.pending_splice {
6806-
pending_splice.pending_funding.as_slice()
6809+
pending_splice.negotiated_candidates.as_slice()
68076810
} else {
68086811
&[]
68096812
}
@@ -6813,7 +6816,7 @@ where
68136816
core::iter::once(&mut self.funding).chain(
68146817
self.pending_splice
68156818
.as_mut()
6816-
.map(|pending_splice| pending_splice.pending_funding.as_mut_slice())
6819+
.map(|pending_splice| pending_splice.negotiated_candidates.as_mut_slice())
68176820
.unwrap_or(&mut [])
68186821
.iter_mut(),
68196822
)
@@ -10716,7 +10719,7 @@ where
1071610719
// Scope `funding` since it is swapped within `promote_splice_funding` and we don't want
1071710720
// to unintentionally use it.
1071810721
let funding = pending_splice
10719-
.pending_funding
10722+
.negotiated_candidates
1072010723
.iter_mut()
1072110724
.find(|funding| funding.get_funding_txid() == Some(splice_txid))
1072210725
.unwrap();
@@ -10791,7 +10794,7 @@ where
1079110794
let mut confirmed_funding_index = None;
1079210795
let mut funding_already_confirmed = false;
1079310796
if let Some(pending_splice) = &mut self.pending_splice {
10794-
for (index, funding) in pending_splice.pending_funding.iter_mut().enumerate() {
10797+
for (index, funding) in pending_splice.negotiated_candidates.iter_mut().enumerate() {
1079510798
if self.context.check_for_funding_tx_confirmed(
1079610799
funding, block_hash, height, index_in_block, &mut confirmed_tx, logger,
1079710800
)? {
@@ -10963,7 +10966,7 @@ where
1096310966
return Err(ClosureReason::ProcessingError { err });
1096410967
},
1096510968
};
10966-
let funding = &mut pending_splice.pending_funding[confirmed_funding_index];
10969+
let funding = &mut pending_splice.negotiated_candidates[confirmed_funding_index];
1096710970

1096810971
// Check if the splice funding transaction was unconfirmed
1096910972
if funding.get_funding_tx_confirmations(height) == 0 {
@@ -11542,7 +11545,7 @@ where
1154211545

1154311546
self.pending_splice = Some(PendingSplice {
1154411547
funding_negotiation: Some(FundingNegotiation::AwaitingAck(funding_negotiation_context)),
11545-
pending_funding: vec![],
11548+
negotiated_candidates: vec![],
1154611549
sent_funding_txid: None,
1154711550
received_funding_txid: None,
1154811551
});
@@ -11765,7 +11768,7 @@ where
1176511768
splice_funding,
1176611769
interactive_tx_constructor,
1176711770
)),
11768-
pending_funding: Vec::new(),
11771+
negotiated_candidates: Vec::new(),
1176911772
received_funding_txid: None,
1177011773
sent_funding_txid: None,
1177111774
});
@@ -11954,7 +11957,7 @@ where
1195411957
};
1195511958

1195611959
if !pending_splice
11957-
.pending_funding
11960+
.negotiated_candidates
1195811961
.iter()
1195911962
.any(|funding| funding.get_funding_txid() == Some(msg.splice_txid))
1196011963
{

0 commit comments

Comments
 (0)