Correct name of `get_counterparty_payment_script` method
What changed, and why it matters
This commit is a simple rename of an internal function from get_counterparty_payment_script to get_countersigner_payment_script, plus an update to its documentation. The old name was misleading because the function actually returns the payment script for the non-broadcaster in a commitment transaction, which can be either party. No behavior of the code changes, and there is no security fix or vulnerability here.
No security action needed. Treat as a normal non-security refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff renames a single Rust function across three files and updates its doc comment. Call sites are updated to use the new name. The function’s logic, signature, and return values are unchanged. The rename clarifies that the script belongs to the countersigner (non-broadcaster), not necessarily the counterparty. This is a code-quality/documentation refactor with no functional or security impact.
Changed components
lightning/src/ln/chan_utils.rslightning/src/chain/channelmonitor.rslightning/src/sign/mod.rsInspect captured patch +9 / −9
diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs
index 8244680..53e0134 100644
--- a/lightning/src/chain/channelmonitor.rs
+++ b/lightning/src/chain/channelmonitor.rs
@@ -1857,7 +1857,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
assert!(commitment_transaction_number_obscure_factor <= (1 << 48));
let holder_pubkeys = &channel_parameters.holder_pubkeys;
- let counterparty_payment_script = chan_utils::get_counterparty_payment_script(
+ let counterparty_payment_script = chan_utils::get_countersigner_payment_script(
&channel_parameters.channel_type_features, &holder_pubkeys.payment_point
);
diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs
index e6a4552..ef58f76 100644
--- a/lightning/src/ln/chan_utils.rs
+++ b/lightning/src/ln/chan_utils.rs
@@ -637,9 +637,9 @@ pub fn get_revokeable_redeemscript(revocation_key: &RevocationKey, contest_delay
res
}
-/// Returns the script for the counterparty's output on a holder's commitment transaction based on
-/// the channel type.
-pub fn get_counterparty_payment_script(
+/// Returns the script for the countersigner's (i.e. non-broadcaster's) output on a commitment
+/// transaction based on the channel type.
+pub fn get_countersigner_payment_script(
channel_type_features: &ChannelTypeFeatures, payment_key: &PublicKey,
) -> ScriptBuf {
if channel_type_features.supports_anchors_zero_fee_htlc_tx() {
diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs
index 9a1db92..5517452 100644
--- a/lightning/src/sign/mod.rs
+++ b/lightning/src/sign/mod.rs
@@ -41,7 +41,7 @@ use crate::chain::transaction::OutPoint;
use crate::crypto::utils::{hkdf_extract_expand_twice, sign, sign_with_aux_rand};
use crate::ln::chan_utils;
use crate::ln::chan_utils::{
- get_counterparty_payment_script, get_revokeable_redeemscript, make_funding_redeemscript,
+ get_countersigner_payment_script, get_revokeable_redeemscript, make_funding_redeemscript,
ChannelPublicKeys, ChannelTransactionParameters, ClosingTransaction, CommitmentTransaction,
HTLCOutputInCommitment, HolderCommitmentTransaction,
};
@@ -1295,8 +1295,8 @@ impl InMemorySigner {
let payment_point_v1 = PublicKey::from_secret_key(secp_ctx, &self.payment_key_v1);
let payment_point_v2 = PublicKey::from_secret_key(secp_ctx, &self.payment_key_v2);
- let spk_v1 = get_counterparty_payment_script(channel_type_features, &payment_point_v1);
- let spk_v2 = get_counterparty_payment_script(channel_type_features, &payment_point_v2);
+ let spk_v1 = get_countersigner_payment_script(channel_type_features, &payment_point_v1);
+ let spk_v2 = get_countersigner_payment_script(channel_type_features, &payment_point_v2);
let (remotepubkey, payment_key) = if spk_v1 == descriptor.output.script_pubkey {
(bitcoin::PublicKey::new(payment_point_v1), &self.payment_key_v1)
@@ -2102,8 +2102,8 @@ impl KeysManager {
.expect("Your RNG is busted")
.private_key;
let pubkey = PublicKey::from_secret_key(secp_ctx, &key);
- res.push(get_counterparty_payment_script(&static_remote_key_features, &pubkey));
- res.push(get_counterparty_payment_script(&zero_fee_htlc_features, &pubkey));
+ res.push(get_countersigner_payment_script(&static_remote_key_features, &pubkey));
+ res.push(get_countersigner_payment_script(&zero_fee_htlc_features, &pubkey));
}
res
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.