Skip to content

Commit 08d296a

Browse files
authored
Merge pull request #1903 from TheBlueMatt/2022-12-1867-followups
Clarify docs on `provide_channel_parameters`
2 parents f6a9382 + 2059190 commit 08d296a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lightning/src/chain/keysinterface.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,12 @@ pub trait BaseSign {
395395
fn sign_channel_announcement(&self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>)
396396
-> Result<(Signature, Signature), ()>;
397397
/// Set the counterparty static channel data, including basepoints,
398-
/// `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these
399-
/// are static channel data, they MUST NOT be allowed to change to different values once set,
400-
/// as LDK may call this method more than once.
398+
/// `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint.
399+
///
400+
/// This data is static, and will never change for a channel once set. For a given [`BaseSign`]
401+
/// instance, LDK will call this method exactly once - either immediately after construction
402+
/// (not including if done via [`KeysInterface::read_chan_signer`]) or when the funding
403+
/// information has been generated.
401404
///
402405
/// channel_parameters.is_populated() MUST be true.
403406
fn provide_channel_parameters(&mut self, channel_parameters: &ChannelTransactionParameters);
@@ -470,8 +473,10 @@ pub trait KeysInterface {
470473
/// This method should return a different value each time it is called, to avoid linking
471474
/// on-chain funds across channels as controlled to the same user.
472475
fn get_shutdown_scriptpubkey(&self) -> ShutdownScript;
473-
/// Get a new set of [`Sign`] for per-channel secrets. These MUST be unique even if you
474-
/// restarted with some stale data!
476+
/// Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through
477+
/// [`KeysInterface::derive_channel_signer`]. The `user_channel_id` is provided to allow
478+
/// implementations of [`KeysInterface`] to maintain a mapping between it and the generated
479+
/// `channel_keys_id`.
475480
///
476481
/// This method must return a different value each time it is called.
477482
fn generate_channel_keys_id(&self, inbound: bool, channel_value_satoshis: u64, user_channel_id: u128) -> [u8; 32];

0 commit comments

Comments
 (0)