Skip to content

Commit e4f690c

Browse files
committed
Change RevocationKey args to make clear one side is a countersig
935a716 changed the parameter names to `RevocationKey` derivation to remove the naming which made clear one of the two parameters is a countersignatory key, which is restored here.
1 parent 029448a commit e4f690c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lightning/src/ln/channel_keys.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,25 @@ impl RevocationKey {
194194
/// [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key
195195
pub fn from_basepoint<T: secp256k1::Verification>(
196196
secp_ctx: &Secp256k1<T>,
197-
basepoint: &RevocationBasepoint,
197+
countersignatory_basepoint: &RevocationBasepoint,
198198
per_commitment_point: &PublicKey,
199199
) -> Self {
200200
let rev_append_commit_hash_key = {
201201
let mut sha = Sha256::engine();
202-
sha.input(&basepoint.to_public_key().serialize());
202+
sha.input(&countersignatory_basepoint.to_public_key().serialize());
203203
sha.input(&per_commitment_point.serialize());
204204

205205
Sha256::from_engine(sha).to_byte_array()
206206
};
207207
let commit_append_rev_hash_key = {
208208
let mut sha = Sha256::engine();
209209
sha.input(&per_commitment_point.serialize());
210-
sha.input(&basepoint.to_public_key().serialize());
210+
sha.input(&countersignatory_basepoint.to_public_key().serialize());
211211

212212
Sha256::from_engine(sha).to_byte_array()
213213
};
214214

215-
let countersignatory_contrib = basepoint.to_public_key().mul_tweak(&secp_ctx, &Scalar::from_be_bytes(rev_append_commit_hash_key).unwrap())
215+
let countersignatory_contrib = countersignatory_basepoint.to_public_key().mul_tweak(&secp_ctx, &Scalar::from_be_bytes(rev_append_commit_hash_key).unwrap())
216216
.expect("Multiplying a valid public key by a hash is expected to never fail per secp256k1 docs");
217217
let broadcaster_contrib = (&per_commitment_point).mul_tweak(&secp_ctx, &Scalar::from_be_bytes(commit_append_rev_hash_key).unwrap())
218218
.expect("Multiplying a valid public key by a hash is expected to never fail per secp256k1 docs");
@@ -229,7 +229,6 @@ impl RevocationKey {
229229
key_read_write!(RevocationKey);
230230

231231

232-
233232
#[cfg(test)]
234233
mod test {
235234
use bitcoin::secp256k1::{Secp256k1, SecretKey, PublicKey};

0 commit comments

Comments
 (0)