Skip to content

Commit febc9e4

Browse files
committed
Correct name of get_counterparty_payment_script method
`get_counterparty_payment_script` fetches the countersigner's (i.e. non-broadcaster) payment script, but that could be ours or or counterparty's. Thus, it should read `get_countersigner_payment_script`, which we fix here.
1 parent a2e7710 commit febc9e4

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
18571857

18581858
assert!(commitment_transaction_number_obscure_factor <= (1 << 48));
18591859
let holder_pubkeys = &channel_parameters.holder_pubkeys;
1860-
let counterparty_payment_script = chan_utils::get_counterparty_payment_script(
1860+
let counterparty_payment_script = chan_utils::get_countersigner_payment_script(
18611861
&channel_parameters.channel_type_features, &holder_pubkeys.payment_point
18621862
);
18631863

lightning/src/ln/chan_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,9 @@ pub fn get_revokeable_redeemscript(revocation_key: &RevocationKey, contest_delay
637637
res
638638
}
639639

640-
/// Returns the script for the counterparty's output on a holder's commitment transaction based on
641-
/// the channel type.
642-
pub fn get_counterparty_payment_script(
640+
/// Returns the script for the countersigner's (i.e. non-broadcaster's) output on a commitment
641+
/// transaction based on the channel type.
642+
pub fn get_countersigner_payment_script(
643643
channel_type_features: &ChannelTypeFeatures, payment_key: &PublicKey,
644644
) -> ScriptBuf {
645645
if channel_type_features.supports_anchors_zero_fee_htlc_tx() {

lightning/src/sign/mod.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use crate::chain::transaction::OutPoint;
4141
use crate::crypto::utils::{hkdf_extract_expand_twice, sign, sign_with_aux_rand};
4242
use crate::ln::chan_utils;
4343
use crate::ln::chan_utils::{
44-
get_counterparty_payment_script, get_revokeable_redeemscript, make_funding_redeemscript,
44+
get_countersigner_payment_script, get_revokeable_redeemscript, make_funding_redeemscript,
4545
ChannelPublicKeys, ChannelTransactionParameters, ClosingTransaction, CommitmentTransaction,
4646
HTLCOutputInCommitment, HolderCommitmentTransaction,
4747
};
@@ -1295,8 +1295,8 @@ impl InMemorySigner {
12951295

12961296
let payment_point_v1 = PublicKey::from_secret_key(secp_ctx, &self.payment_key_v1);
12971297
let payment_point_v2 = PublicKey::from_secret_key(secp_ctx, &self.payment_key_v2);
1298-
let spk_v1 = get_counterparty_payment_script(channel_type_features, &payment_point_v1);
1299-
let spk_v2 = get_counterparty_payment_script(channel_type_features, &payment_point_v2);
1298+
let spk_v1 = get_countersigner_payment_script(channel_type_features, &payment_point_v1);
1299+
let spk_v2 = get_countersigner_payment_script(channel_type_features, &payment_point_v2);
13001300

13011301
let (remotepubkey, payment_key) = if spk_v1 == descriptor.output.script_pubkey {
13021302
(bitcoin::PublicKey::new(payment_point_v1), &self.payment_key_v1)
@@ -2075,7 +2075,12 @@ impl KeysManager {
20752075
}
20762076

20772077
/// Gets the set of possible `script_pubkey`s which can appear on chain for our
2078-
/// non-HTLC-encumbered balance if our counterparty force-closes the channel.
2078+
/// non-HTLC-encumbered balance if our counterparty force-closes a channel.
2079+
///
2080+
/// If you've lost all data except your seed, asking your peers nicely to force-close the
2081+
/// chanels they had with you (and hoping they don't broadcast a stale state and that there are
2082+
/// no pending HTLCs in the latest state) and scanning the chain for these `script_pubkey`s can
2083+
/// allow you to recover (some of) your funds.
20792084
///
20802085
/// Only channels opened when using a [`KeysManager`] with the `v2_remote_key_derivation`
20812086
/// argument to [`KeysManager::new`] set, or any spliced channels will close to such scripts,
@@ -2097,8 +2102,8 @@ impl KeysManager {
20972102
.expect("Your RNG is busted")
20982103
.private_key;
20992104
let pubkey = PublicKey::from_secret_key(secp_ctx, &key);
2100-
res.push(get_counterparty_payment_script(&static_remote_key_features, &pubkey));
2101-
res.push(get_counterparty_payment_script(&zero_fee_htlc_features, &pubkey));
2105+
res.push(get_countersigner_payment_script(&static_remote_key_features, &pubkey));
2106+
res.push(get_countersigner_payment_script(&zero_fee_htlc_features, &pubkey));
21022107
}
21032108
res
21042109
}

0 commit comments

Comments
 (0)