Skip to content

Commit 029448a

Browse files
committed
Update docs on RevocationKey for clarity and to provide more info
This also adds required linebreaks to keep the docs to a reasonable width.
1 parent 83fe0b8 commit 029448a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lightning/src/ln/channel_keys.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,27 @@ basepoint_impl!(RevocationBasepoint);
171171
key_read_write!(RevocationBasepoint);
172172

173173

174-
/// [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation) is a child key of a revocation basepoint,
175-
/// that enables a node to create a justice transaction punishing a counterparty for an attempt to steal funds. Used to in generation of commitment and htlc outputs.
174+
/// The revocation key is used to allow a channel party to revoke their state - giving their
175+
/// counterparty the required material to claim all of their funds if they broadcast that state.
176+
///
177+
/// Each commitment transaction has a revocation key based on the basepoint and
178+
/// per_commitment_point which is used in both commitment and HTLC transactions.
179+
///
180+
/// See [the BOLT spec for derivation details]
181+
/// (https://github.com/lightning/bolts/blob/master/03-transactions.md#revocationpubkey-derivation)
176182
#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)]
177183
pub struct RevocationKey(pub PublicKey);
178184

179185
impl RevocationKey {
180-
/// Derives a per-commitment-transaction revocation public key from its constituent parts. This is
181-
/// the public equivalend of derive_private_revocation_key - using only public keys to derive a
182-
/// public key instead of private keys.
183-
///
184-
/// Only the cheating participant owns a valid witness to propagate a revoked
185-
/// commitment transaction, thus per_commitment_point always come from cheater
186-
/// and revocation_base_point always come from punisher, which is the broadcaster
187-
/// of the transaction spending with this key knowledge.
186+
/// Derives a per-commitment-transaction revocation public key from one party's per-commitment
187+
/// point and the other party's [`RevocationBasepoint`]. This is the public equivalent of
188+
/// [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public
189+
/// key instead of private keys.
188190
///
189191
/// Note that this is infallible iff we trust that at least one of the two input keys are randomly
190192
/// generated (ie our own).
193+
///
194+
/// [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key
191195
pub fn from_basepoint<T: secp256k1::Verification>(
192196
secp_ctx: &Secp256k1<T>,
193197
basepoint: &RevocationBasepoint,

0 commit comments

Comments
 (0)