Skip to content

Commit 0fabfbc

Browse files
committed
Slightly expand documentation on KeysInterface
Specifically, this notes when methods can or can not return the same value on each call.
1 parent 5d8dd02 commit 0fabfbc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,18 +337,29 @@ pub trait KeysInterface: Send + Sync {
337337
/// A type which implements ChannelKeys which will be returned by get_channel_keys.
338338
type ChanKeySigner : ChannelKeys;
339339

340-
/// Get node secret key (aka node_id or network_key)
340+
/// Get node secret key (aka node_id or network_key).
341+
///
342+
/// This method must return the same value each time it is called.
341343
fn get_node_secret(&self) -> SecretKey;
342-
/// Get destination redeemScript to encumber static protocol exit points.
344+
/// Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
345+
///
346+
/// This method should return a different value each time it is called, for privacy reasons.
343347
fn get_destination_script(&self) -> Script;
344-
/// Get shutdown_pubkey to use as PublicKey at channel closure
348+
/// Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
349+
/// a channel.
350+
///
351+
/// This method should return a different value each time it is called, for privacy reasons.
345352
fn get_shutdown_pubkey(&self) -> PublicKey;
346353
/// Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
347354
/// restarted with some stale data!
355+
///
356+
/// This method must return a different value each time it is called.
348357
fn get_channel_keys(&self, inbound: bool, channel_value_satoshis: u64) -> Self::ChanKeySigner;
349358
/// Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
350359
/// onion packets and for temporary channel IDs. There is no requirement that these be
351360
/// persisted anywhere, though they must be unique across restarts.
361+
///
362+
/// This method must return a different value each time it is called.
352363
fn get_secure_random_bytes(&self) -> [u8; 32];
353364

354365
/// Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.

0 commit comments

Comments
 (0)