Skip to content

Commit 95da809

Browse files
committed
Simplify and clarify derive_add_tweak documentation
1 parent 2c0fcf2 commit 95da809

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lightning/src/ln/channel_keys.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ macro_rules! basepoint_impl {
3838
self.0
3939
}
4040

41-
/// Derives a per-commitment-transaction (eg an htlc key or delayed_payment key) private key addition tweak
42-
/// from a basepoint and a per_commitment_point:
41+
/// Derives the "tweak" used in calculate [`Self::from_basepoint`].
42+
///
43+
/// [`Self::from_basepoint`] calculates a private key as:
4344
/// `privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`
44-
/// This calculates the hash part in the tweak derivation process, which is used to ensure
45-
/// that each key is unique and cannot be guessed by an external party. It is equivalent
46-
/// to the `from_basepoint` method, but without the addition operation, providing just the
47-
/// tweak from the hash of the per_commitment_point and the basepoint.
45+
///
46+
/// This calculates the hash part in the tweak derivation process, which is used to
47+
/// ensure that each key is unique and cannot be guessed by an external party.
4848
pub fn derive_add_tweak(&self, per_commitment_point: &PublicKey) -> [u8; 32] {
4949
let mut sha = Sha256::engine();
5050
sha.input(&per_commitment_point.serialize());

0 commit comments

Comments
 (0)