Skip to content

Commit a6cef30

Browse files
committed
Rename ChannelContext::counterparty_cur_commitment_point
To align with the "current" and "next" nomenclature used by HolderCommitmentPoint, update the naming of the counterparty commitment point field to use "next" instead of "current".
1 parent 9d7ec5f commit a6cef30

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

lightning/src/ln/channel.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ where
26692669
is_manual_broadcast: bool,
26702670
is_batch_funding: Option<()>,
26712671

2672-
counterparty_cur_commitment_point: Option<PublicKey>,
2672+
counterparty_next_commitment_point: Option<PublicKey>,
26732673
counterparty_prev_commitment_point: Option<PublicKey>,
26742674
counterparty_node_id: PublicKey,
26752675

@@ -2821,7 +2821,7 @@ where
28212821
let context = self.context();
28222822
let commitment_data = context.build_commitment_transaction(self.funding(),
28232823
context.counterparty_next_commitment_transaction_number,
2824-
&context.counterparty_cur_commitment_point.unwrap(), false, false, logger);
2824+
&context.counterparty_next_commitment_point.unwrap(), false, false, logger);
28252825
let counterparty_initial_commitment_tx = commitment_data.tx;
28262826
let counterparty_trusted_tx = counterparty_initial_commitment_tx.trust();
28272827
let counterparty_initial_bitcoin_tx = counterparty_trusted_tx.built_transaction();
@@ -3297,7 +3297,7 @@ where
32973297

32983298
is_batch_funding: None,
32993299

3300-
counterparty_cur_commitment_point: Some(open_channel_fields.first_per_commitment_point),
3300+
counterparty_next_commitment_point: Some(open_channel_fields.first_per_commitment_point),
33013301
counterparty_prev_commitment_point: None,
33023302
counterparty_node_id,
33033303

@@ -3535,7 +3535,7 @@ where
35353535

35363536
is_batch_funding: None,
35373537

3538-
counterparty_cur_commitment_point: None,
3538+
counterparty_next_commitment_point: None,
35393539
counterparty_prev_commitment_point: None,
35403540
counterparty_node_id,
35413541

@@ -3915,7 +3915,7 @@ where
39153915
pubkeys: counterparty_pubkeys,
39163916
});
39173917

3918-
self.counterparty_cur_commitment_point = Some(common_fields.first_per_commitment_point);
3918+
self.counterparty_next_commitment_point = Some(common_fields.first_per_commitment_point);
39193919
self.counterparty_shutdown_scriptpubkey = counterparty_shutdown_scriptpubkey;
39203920

39213921
self.channel_state = ChannelState::NegotiatingFunding(
@@ -5609,7 +5609,7 @@ where
56095609
L::Target: Logger,
56105610
{
56115611
let mut commitment_number = self.counterparty_next_commitment_transaction_number;
5612-
let mut commitment_point = self.counterparty_cur_commitment_point.unwrap();
5612+
let mut commitment_point = self.counterparty_next_commitment_point.unwrap();
56135613

56145614
// Use the previous commitment number and point when splicing since they shouldn't change.
56155615
if commitment_number != INITIAL_COMMITMENT_NUMBER {
@@ -5682,13 +5682,13 @@ where
56825682
#[cfg(all(test))]
56835683
pub fn get_initial_counterparty_commitment_signature_for_test<L: Deref>(
56845684
&mut self, funding: &mut FundingScope, logger: &L,
5685-
counterparty_cur_commitment_point_override: PublicKey,
5685+
counterparty_next_commitment_point_override: PublicKey,
56865686
) -> Option<Signature>
56875687
where
56885688
SP::Target: SignerProvider,
56895689
L::Target: Logger,
56905690
{
5691-
self.counterparty_cur_commitment_point = Some(counterparty_cur_commitment_point_override);
5691+
self.counterparty_next_commitment_point = Some(counterparty_next_commitment_point_override);
56925692
self.get_initial_counterparty_commitment_signature(funding, logger)
56935693
}
56945694

@@ -6778,8 +6778,8 @@ where
67786778
let expected_point =
67796779
if self.context.counterparty_next_commitment_transaction_number == INITIAL_COMMITMENT_NUMBER - 1 {
67806780
// If they haven't ever sent an updated point, the point they send should match
6781-
// the current one.
6782-
self.context.counterparty_cur_commitment_point
6781+
// the next one.
6782+
self.context.counterparty_next_commitment_point
67836783
} else if self.context.counterparty_next_commitment_transaction_number == INITIAL_COMMITMENT_NUMBER - 2 {
67846784
// If we've advanced the commitment number once, the second commitment point is
67856785
// at `counterparty_prev_commitment_point`, which is not yet revoked.
@@ -6798,8 +6798,8 @@ where
67986798
return Ok(None);
67996799
}
68006800

6801-
self.context.counterparty_prev_commitment_point = self.context.counterparty_cur_commitment_point;
6802-
self.context.counterparty_cur_commitment_point = Some(msg.next_per_commitment_point);
6801+
self.context.counterparty_prev_commitment_point = self.context.counterparty_next_commitment_point;
6802+
self.context.counterparty_next_commitment_point = Some(msg.next_per_commitment_point);
68036803
// Clear any interactive signing session.
68046804
self.interactive_tx_signing_session = None;
68056805

@@ -7688,8 +7688,8 @@ where
76887688
self.context.channel_state.clear_awaiting_remote_revoke();
76897689
self.mark_response_received();
76907690
self.context.counterparty_prev_commitment_point =
7691-
self.context.counterparty_cur_commitment_point;
7692-
self.context.counterparty_cur_commitment_point = Some(msg.next_per_commitment_point);
7691+
self.context.counterparty_next_commitment_point;
7692+
self.context.counterparty_next_commitment_point = Some(msg.next_per_commitment_point);
76937693
self.context.counterparty_next_commitment_transaction_number -= 1;
76947694

76957695
if self.context.announcement_sigs_state == AnnouncementSigsState::Committed {
@@ -8430,7 +8430,7 @@ where
84308430
let funding_signed = if self.context.signer_pending_funding && !self.funding.is_outbound() {
84318431
let commitment_data = self.context.build_commitment_transaction(&self.funding,
84328432
self.context.counterparty_next_commitment_transaction_number + 1,
8433-
&self.context.counterparty_cur_commitment_point.unwrap(), false, false, logger);
8433+
&self.context.counterparty_next_commitment_point.unwrap(), false, false, logger);
84348434
let counterparty_initial_commitment_tx = commitment_data.tx;
84358435
self.context.get_funding_signed_msg(&self.funding.channel_transaction_parameters, logger, counterparty_initial_commitment_tx)
84368436
} else { None };
@@ -11203,7 +11203,7 @@ where
1120311203
commitment_txid: counterparty_commitment_tx.trust().txid(),
1120411204
htlc_outputs,
1120511205
commitment_number: self.context.counterparty_next_commitment_transaction_number,
11206-
their_per_commitment_point: self.context.counterparty_cur_commitment_point.unwrap(),
11206+
their_per_commitment_point: self.context.counterparty_next_commitment_point.unwrap(),
1120711207
feerate_per_kw: Some(counterparty_commitment_tx.feerate_per_kw()),
1120811208
to_broadcaster_value_sat: Some(counterparty_commitment_tx.to_broadcaster_value_sat()),
1120911209
to_countersignatory_value_sat: Some(counterparty_commitment_tx.to_countersignatory_value_sat()),
@@ -11260,7 +11260,7 @@ where
1126011260
{
1126111261
let commitment_data = self.context.build_commitment_transaction(
1126211262
funding, self.context.counterparty_next_commitment_transaction_number,
11263-
&self.context.counterparty_cur_commitment_point.unwrap(), false, true, logger,
11263+
&self.context.counterparty_next_commitment_point.unwrap(), false, true, logger,
1126411264
);
1126511265
let counterparty_commitment_tx = commitment_data.tx;
1126611266

@@ -11311,7 +11311,7 @@ where
1131111311

1131211312
let commitment_data = self.context.build_commitment_transaction(
1131311313
funding, self.context.counterparty_next_commitment_transaction_number,
11314-
&self.context.counterparty_cur_commitment_point.unwrap(), false, true, logger,
11314+
&self.context.counterparty_next_commitment_point.unwrap(), false, true, logger,
1131511315
);
1131611316
let counterparty_commitment_tx = commitment_data.tx;
1131711317

@@ -11880,7 +11880,7 @@ where
1188011880
fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
1188111881
let commitment_data = self.context.build_commitment_transaction(&self.funding,
1188211882
self.context.counterparty_next_commitment_transaction_number,
11883-
&self.context.counterparty_cur_commitment_point.unwrap(), false, false, logger);
11883+
&self.context.counterparty_next_commitment_point.unwrap(), false, false, logger);
1188411884
let counterparty_initial_commitment_tx = commitment_data.tx;
1188511885
let signature = match &self.context.holder_signer {
1188611886
// TODO (taproot|arik): move match into calling method for Taproot
@@ -13167,7 +13167,7 @@ where
1316713167
self.funding.channel_transaction_parameters.write(writer)?;
1316813168
self.funding.funding_transaction.write(writer)?;
1316913169

13170-
self.context.counterparty_cur_commitment_point.write(writer)?;
13170+
self.context.counterparty_next_commitment_point.write(writer)?;
1317113171
self.context.counterparty_prev_commitment_point.write(writer)?;
1317213172
self.context.counterparty_node_id.write(writer)?;
1317313173

@@ -13568,7 +13568,7 @@ where
1356813568
ReadableArgs::<Option<u64>>::read(reader, Some(channel_value_satoshis))?;
1356913569
let funding_transaction: Option<Transaction> = Readable::read(reader)?;
1357013570

13571-
let counterparty_cur_commitment_point = Readable::read(reader)?;
13571+
let counterparty_next_commitment_point = Readable::read(reader)?;
1357213572

1357313573
let counterparty_prev_commitment_point = Readable::read(reader)?;
1357413574
let counterparty_node_id = Readable::read(reader)?;
@@ -14025,7 +14025,7 @@ where
1402514025

1402614026
is_batch_funding,
1402714027

14028-
counterparty_cur_commitment_point,
14028+
counterparty_next_commitment_point,
1402914029
counterparty_prev_commitment_point,
1403014030
counterparty_node_id,
1403114031

0 commit comments

Comments
 (0)