Skip to content

Commit 6bde10c

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 a6cef30 commit 6bde10c

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
@@ -2670,7 +2670,7 @@ where
26702670
is_batch_funding: Option<()>,
26712671

26722672
counterparty_next_commitment_point: Option<PublicKey>,
2673-
counterparty_prev_commitment_point: Option<PublicKey>,
2673+
counterparty_current_commitment_point: Option<PublicKey>,
26742674
counterparty_node_id: PublicKey,
26752675

26762676
counterparty_shutdown_scriptpubkey: Option<ScriptBuf>,
@@ -3298,7 +3298,7 @@ where
32983298
is_batch_funding: None,
32993299

33003300
counterparty_next_commitment_point: Some(open_channel_fields.first_per_commitment_point),
3301-
counterparty_prev_commitment_point: None,
3301+
counterparty_current_commitment_point: None,
33023302
counterparty_node_id,
33033303

33043304
counterparty_shutdown_scriptpubkey,
@@ -3536,7 +3536,7 @@ where
35363536
is_batch_funding: None,
35373537

35383538
counterparty_next_commitment_point: None,
3539-
counterparty_prev_commitment_point: None,
3539+
counterparty_current_commitment_point: None,
35403540
counterparty_node_id,
35413541

35423542
counterparty_shutdown_scriptpubkey: None,
@@ -5614,7 +5614,7 @@ where
56145614
// Use the previous commitment number and point when splicing since they shouldn't change.
56155615
if commitment_number != INITIAL_COMMITMENT_NUMBER {
56165616
commitment_number += 1;
5617-
commitment_point = self.counterparty_prev_commitment_point.unwrap();
5617+
commitment_point = self.counterparty_current_commitment_point.unwrap();
56185618
}
56195619

56205620
let commitment_data = self.build_commitment_transaction(
@@ -6782,9 +6782,9 @@ where
67826782
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
6785-
// at `counterparty_prev_commitment_point`, which is not yet revoked.
6786-
debug_assert!(self.context.counterparty_prev_commitment_point.is_some());
6787-
self.context.counterparty_prev_commitment_point
6785+
// at `counterparty_current_commitment_point`, which is not yet revoked.
6786+
debug_assert!(self.context.counterparty_current_commitment_point.is_some());
6787+
self.context.counterparty_current_commitment_point
67886788
} else {
67896789
// If they have sent updated points, channel_ready is always supposed to match
67906790
// their "first" point, which we re-derive here.
@@ -6798,7 +6798,7 @@ where
67986798
return Ok(None);
67996799
}
68006800

6801-
self.context.counterparty_prev_commitment_point = self.context.counterparty_next_commitment_point;
6801+
self.context.counterparty_current_commitment_point = self.context.counterparty_next_commitment_point;
68026802
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;
@@ -7028,7 +7028,7 @@ where
70287028
.build_commitment_transaction(
70297029
pending_splice_funding,
70307030
self.context.counterparty_next_commitment_transaction_number + 1,
7031-
&self.context.counterparty_prev_commitment_point.unwrap(),
7031+
&self.context.counterparty_current_commitment_point.unwrap(),
70327032
false,
70337033
false,
70347034
logger,
@@ -7615,11 +7615,11 @@ where
76157615
"Peer provided an invalid per_commitment_secret".to_owned()
76167616
);
76177617

7618-
if let Some(counterparty_prev_commitment_point) =
7619-
self.context.counterparty_prev_commitment_point
7618+
if let Some(counterparty_current_commitment_point) =
7619+
self.context.counterparty_current_commitment_point
76207620
{
76217621
if PublicKey::from_secret_key(&self.context.secp_ctx, &secret)
7622-
!= counterparty_prev_commitment_point
7622+
!= counterparty_current_commitment_point
76237623
{
76247624
return Err(ChannelError::close("Got a revoke commitment secret which didn't correspond to their current pubkey".to_owned()));
76257625
}
@@ -7687,7 +7687,7 @@ where
76877687
// channel based on that, but stepping stuff here should be safe either way.
76887688
self.context.channel_state.clear_awaiting_remote_revoke();
76897689
self.mark_response_received();
7690-
self.context.counterparty_prev_commitment_point =
7690+
self.context.counterparty_current_commitment_point =
76917691
self.context.counterparty_next_commitment_point;
76927692
self.context.counterparty_next_commitment_point = Some(msg.next_per_commitment_point);
76937693
self.context.counterparty_next_commitment_transaction_number -= 1;
@@ -13168,7 +13168,7 @@ where
1316813168
self.funding.funding_transaction.write(writer)?;
1316913169

1317013170
self.context.counterparty_next_commitment_point.write(writer)?;
13171-
self.context.counterparty_prev_commitment_point.write(writer)?;
13171+
self.context.counterparty_current_commitment_point.write(writer)?;
1317213172
self.context.counterparty_node_id.write(writer)?;
1317313173

1317413174
self.context.counterparty_shutdown_scriptpubkey.write(writer)?;
@@ -13570,7 +13570,7 @@ where
1357013570

1357113571
let counterparty_next_commitment_point = Readable::read(reader)?;
1357213572

13573-
let counterparty_prev_commitment_point = Readable::read(reader)?;
13573+
let counterparty_current_commitment_point = Readable::read(reader)?;
1357413574
let counterparty_node_id = Readable::read(reader)?;
1357513575

1357613576
let counterparty_shutdown_scriptpubkey = Readable::read(reader)?;
@@ -14026,7 +14026,7 @@ where
1402614026
is_batch_funding,
1402714027

1402814028
counterparty_next_commitment_point,
14029-
counterparty_prev_commitment_point,
14029+
counterparty_current_commitment_point,
1403014030
counterparty_node_id,
1403114031

1403214032
counterparty_shutdown_scriptpubkey,

0 commit comments

Comments
 (0)