Skip to content

Commit fc348b6

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 d243af1 commit fc348b6

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

lightning/src/ln/channel.rs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,10 @@ impl FundingScope {
21752175
struct PendingSplice {
21762176
pub our_funding_contribution: i64,
21772177
funding: Option<FundingScope>,
2178-
pending_funding: Vec<FundingScope>,
2178+
2179+
/// Funding candidates that have been negotiated but have not reached enough confirmations
2180+
/// by both counterparties to have exchanged `splice_locked` and be promoted.
2181+
negotiated_candidates: Vec<FundingScope>,
21792182

21802183
/// The funding txid used in the `splice_locked` sent to the counterparty.
21812184
sent_funding_txid: Option<Txid>,
@@ -2192,9 +2195,9 @@ impl PendingSplice {
21922195
where
21932196
SP::Target: SignerProvider,
21942197
{
2195-
debug_assert!(confirmed_funding_index < self.pending_funding.len());
2198+
debug_assert!(confirmed_funding_index < self.negotiated_candidates.len());
21962199

2197-
let funding = self.pending_funding.get(confirmed_funding_index).unwrap();
2200+
let funding = self.negotiated_candidates.get(confirmed_funding_index).unwrap();
21982201
if !context.check_funding_meets_minimum_depth(funding, height) {
21992202
return None;
22002203
}
@@ -6052,7 +6055,7 @@ where
60526055
{
60536056
fn pending_funding(&self) -> &[FundingScope] {
60546057
if let Some(pending_splice) = &self.pending_splice {
6055-
pending_splice.pending_funding.as_slice()
6058+
pending_splice.negotiated_candidates.as_slice()
60566059
} else {
60576060
&[]
60586061
}
@@ -7305,7 +7308,7 @@ where
73057308
*self.funding.next_local_commitment_tx_fee_info_cached.lock().unwrap() = None;
73067309
*self.funding.next_remote_commitment_tx_fee_info_cached.lock().unwrap() = None;
73077310
if let Some(pending_splice) = self.pending_splice.as_mut() {
7308-
for funding in pending_splice.pending_funding.iter_mut() {
7311+
for funding in pending_splice.negotiated_candidates.iter_mut() {
73097312
*funding.next_local_commitment_tx_fee_info_cached.lock().unwrap() = None;
73107313
*funding.next_remote_commitment_tx_fee_info_cached.lock().unwrap() = None;
73117314
}
@@ -7512,7 +7515,7 @@ where
75127515
self.funding.value_to_self_msat =
75137516
(self.funding.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
75147517
if let Some(pending_splice) = self.pending_splice.as_mut() {
7515-
for funding in pending_splice.pending_funding.iter_mut() {
7518+
for funding in pending_splice.negotiated_candidates.iter_mut() {
75167519
funding.value_to_self_msat =
75177520
(funding.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
75187521
}
@@ -9553,7 +9556,7 @@ where
95539556

95549557
let pending_splice = self.pending_splice.as_mut().unwrap();
95559558

9556-
debug_assert!(confirmed_funding_index < pending_splice.pending_funding.len());
9559+
debug_assert!(confirmed_funding_index < pending_splice.negotiated_candidates.len());
95579560

95589561
let splice_txid = match pending_splice.sent_funding_txid {
95599562
Some(sent_funding_txid) => sent_funding_txid,
@@ -9571,7 +9574,8 @@ where
95719574
&self.context.channel_id,
95729575
);
95739576

9574-
let funding = pending_splice.pending_funding.get_mut(confirmed_funding_index).unwrap();
9577+
let funding =
9578+
pending_splice.negotiated_candidates.get_mut(confirmed_funding_index).unwrap();
95759579
debug_assert_eq!(Some(splice_txid), funding.get_funding_txid());
95769580
promote_splice_funding!(self, funding);
95779581

@@ -9646,7 +9650,7 @@ where
96469650
let mut funding_already_confirmed = false;
96479651
#[cfg(splicing)]
96489652
if let Some(pending_splice) = &mut self.pending_splice {
9649-
for (index, funding) in pending_splice.pending_funding.iter_mut().enumerate() {
9653+
for (index, funding) in pending_splice.negotiated_candidates.iter_mut().enumerate() {
96509654
if self.context.check_for_funding_tx_confirmed(
96519655
funding, block_hash, height, index_in_block, &mut confirmed_tx, logger,
96529656
)? {
@@ -9681,7 +9685,7 @@ where
96819685
) {
96829686
for &(idx, tx) in txdata.iter() {
96839687
if idx > index_in_block {
9684-
let funding = pending_splice.pending_funding.get(confirmed_funding_index).unwrap();
9688+
let funding = pending_splice.negotiated_candidates.get(confirmed_funding_index).unwrap();
96859689
self.context.check_for_funding_tx_spent(funding, tx, logger)?;
96869690
}
96879691
}
@@ -9711,7 +9715,7 @@ where
97119715
self.context.check_for_funding_tx_spent(&self.funding, tx, logger)?;
97129716
#[cfg(splicing)]
97139717
if let Some(pending_splice) = self.pending_splice.as_ref() {
9714-
for funding in pending_splice.pending_funding.iter() {
9718+
for funding in pending_splice.negotiated_candidates.iter() {
97159719
self.context.check_for_funding_tx_spent(funding, tx, logger)?;
97169720
}
97179721
}
@@ -9840,7 +9844,7 @@ where
98409844
return Err(ClosureReason::ProcessingError { err });
98419845
},
98429846
};
9843-
let funding = pending_splice.pending_funding.get_mut(confirmed_funding_index).unwrap();
9847+
let funding = pending_splice.negotiated_candidates.get_mut(confirmed_funding_index).unwrap();
98449848

98459849
// Check if the splice funding transaction was unconfirmed
98469850
if funding.get_funding_tx_confirmations(height) == 0 {
@@ -9928,7 +9932,7 @@ where
99289932
.or_else(|| {
99299933
self.pending_splice.as_mut().and_then(|pending_splice| {
99309934
pending_splice
9931-
.pending_funding
9935+
.negotiated_candidates
99329936
.iter_mut()
99339937
.find(|funding| funding.get_funding_txid() == Some(*txid))
99349938
})
@@ -10288,7 +10292,7 @@ where
1028810292
self.pending_splice = Some(PendingSplice {
1028910293
our_funding_contribution: our_funding_contribution_satoshis,
1029010294
funding: None,
10291-
pending_funding: vec![],
10295+
negotiated_candidates: vec![],
1029210296
sent_funding_txid: None,
1029310297
received_funding_txid: None,
1029410298
});
@@ -10406,7 +10410,7 @@ where
1040610410
if let Some(sent_funding_txid) = pending_splice.sent_funding_txid {
1040710411
if sent_funding_txid == msg.splice_txid {
1040810412
if let Some(funding) = pending_splice
10409-
.pending_funding
10413+
.negotiated_candidates
1041010414
.iter_mut()
1041110415
.find(|funding| funding.get_funding_txid() == Some(sent_funding_txid))
1041210416
{

0 commit comments

Comments
 (0)