Skip to content

Commit 2501e09

Browse files
committed
Rename ChannelContext::counterparty_prev_commitment_point
To align with the "current" and "next" nomenclature used by HolderCommitmentPoint, update the naming of the counterparty commitment point field to use "current" instead of "previous".
1 parent 8894270 commit 2501e09

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lightning/src/ln/channel.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,7 +2644,7 @@ where
26442644
is_batch_funding: Option<()>,
26452645

26462646
counterparty_next_commitment_point: Option<PublicKey>,
2647-
counterparty_prev_commitment_point: Option<PublicKey>,
2647+
counterparty_current_commitment_point: Option<PublicKey>,
26482648
counterparty_node_id: PublicKey,
26492649

26502650
counterparty_shutdown_scriptpubkey: Option<ScriptBuf>,
@@ -3276,7 +3276,7 @@ where
32763276
is_batch_funding: None,
32773277

32783278
counterparty_next_commitment_point: Some(open_channel_fields.first_per_commitment_point),
3279-
counterparty_prev_commitment_point: None,
3279+
counterparty_current_commitment_point: None,
32803280
counterparty_node_id,
32813281

32823282
counterparty_shutdown_scriptpubkey,
@@ -3516,7 +3516,7 @@ where
35163516
is_batch_funding: None,
35173517

35183518
counterparty_next_commitment_point: None,
3519-
counterparty_prev_commitment_point: None,
3519+
counterparty_current_commitment_point: None,
35203520
counterparty_node_id,
35213521

35223522
counterparty_shutdown_scriptpubkey: None,
@@ -5596,7 +5596,7 @@ where
55965596
// Use the previous commitment number and point when splicing since they shouldn't change.
55975597
if commitment_number != INITIAL_COMMITMENT_NUMBER {
55985598
commitment_number += 1;
5599-
commitment_point = self.counterparty_prev_commitment_point.unwrap();
5599+
commitment_point = self.counterparty_current_commitment_point.unwrap();
56005600
}
56015601

56025602
let commitment_data = self.build_commitment_transaction(
@@ -6758,9 +6758,9 @@ where
67586758
self.context.counterparty_next_commitment_point
67596759
} else if self.context.counterparty_next_commitment_transaction_number == INITIAL_COMMITMENT_NUMBER - 2 {
67606760
// If we've advanced the commitment number once, the second commitment point is
6761-
// at `counterparty_prev_commitment_point`, which is not yet revoked.
6762-
debug_assert!(self.context.counterparty_prev_commitment_point.is_some());
6763-
self.context.counterparty_prev_commitment_point
6761+
// at `counterparty_current_commitment_point`, which is not yet revoked.
6762+
debug_assert!(self.context.counterparty_current_commitment_point.is_some());
6763+
self.context.counterparty_current_commitment_point
67646764
} else {
67656765
// If they have sent updated points, channel_ready is always supposed to match
67666766
// their "first" point, which we re-derive here.
@@ -6774,7 +6774,7 @@ where
67746774
return Ok(None);
67756775
}
67766776

6777-
self.context.counterparty_prev_commitment_point = self.context.counterparty_next_commitment_point;
6777+
self.context.counterparty_current_commitment_point = self.context.counterparty_next_commitment_point;
67786778
self.context.counterparty_next_commitment_point = Some(msg.next_per_commitment_point);
67796779
// Clear any interactive signing session.
67806780
self.interactive_tx_signing_session = None;
@@ -7004,7 +7004,7 @@ where
70047004
.build_commitment_transaction(
70057005
pending_splice_funding,
70067006
self.context.counterparty_next_commitment_transaction_number + 1,
7007-
&self.context.counterparty_prev_commitment_point.unwrap(),
7007+
&self.context.counterparty_current_commitment_point.unwrap(),
70087008
false,
70097009
false,
70107010
logger,
@@ -7591,11 +7591,11 @@ where
75917591
"Peer provided an invalid per_commitment_secret".to_owned()
75927592
);
75937593

7594-
if let Some(counterparty_prev_commitment_point) =
7595-
self.context.counterparty_prev_commitment_point
7594+
if let Some(counterparty_current_commitment_point) =
7595+
self.context.counterparty_current_commitment_point
75967596
{
75977597
if PublicKey::from_secret_key(&self.context.secp_ctx, &secret)
7598-
!= counterparty_prev_commitment_point
7598+
!= counterparty_current_commitment_point
75997599
{
76007600
return Err(ChannelError::close("Got a revoke commitment secret which didn't correspond to their current pubkey".to_owned()));
76017601
}
@@ -7663,7 +7663,7 @@ where
76637663
// channel based on that, but stepping stuff here should be safe either way.
76647664
self.context.channel_state.clear_awaiting_remote_revoke();
76657665
self.mark_response_received();
7666-
self.context.counterparty_prev_commitment_point =
7666+
self.context.counterparty_current_commitment_point =
76677667
self.context.counterparty_next_commitment_point;
76687668
self.context.counterparty_next_commitment_point = Some(msg.next_per_commitment_point);
76697669
self.context.counterparty_next_commitment_transaction_number -= 1;
@@ -13133,7 +13133,7 @@ where
1313313133
self.funding.funding_transaction.write(writer)?;
1313413134

1313513135
self.context.counterparty_next_commitment_point.write(writer)?;
13136-
self.context.counterparty_prev_commitment_point.write(writer)?;
13136+
self.context.counterparty_current_commitment_point.write(writer)?;
1313713137
self.context.counterparty_node_id.write(writer)?;
1313813138

1313913139
self.context.counterparty_shutdown_scriptpubkey.write(writer)?;
@@ -13534,7 +13534,7 @@ where
1353413534

1353513535
let counterparty_next_commitment_point = Readable::read(reader)?;
1353613536

13537-
let counterparty_prev_commitment_point = Readable::read(reader)?;
13537+
let counterparty_current_commitment_point = Readable::read(reader)?;
1353813538
let counterparty_node_id = Readable::read(reader)?;
1353913539

1354013540
let counterparty_shutdown_scriptpubkey = Readable::read(reader)?;
@@ -13987,7 +13987,7 @@ where
1398713987
is_batch_funding,
1398813988

1398913989
counterparty_next_commitment_point,
13990-
counterparty_prev_commitment_point,
13990+
counterparty_current_commitment_point,
1399113991
counterparty_node_id,
1399213992

1399313993
counterparty_shutdown_scriptpubkey,

0 commit comments

Comments
 (0)