KeysInterface docs: note that Recipient type must be supported by impl
authorValentine Wallace <vwallace@protonmail.com>
Sat, 22 Oct 2022 00:30:49 +0000 (20:30 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Mon, 24 Oct 2022 15:38:30 +0000 (11:38 -0400)
lightning/src/chain/keysinterface.rs

index 5828b488122ead57c5cb946352fe593fe71d6bb8..6e13d7a09056ba02b91d8f011420d2f47a5643e9 100644 (file)
@@ -411,6 +411,8 @@ pub trait KeysInterface {
        ///
        /// This method must return the same value each time it is called with a given `Recipient`
        /// parameter.
+       ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
        fn get_node_secret(&self, recipient: Recipient) -> Result<SecretKey, ()>;
        /// Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in
        /// [`get_node_secret`].
@@ -418,6 +420,8 @@ pub trait KeysInterface {
        /// This method must return the same value each time it is called with a given `Recipient`
        /// parameter.
        ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
+       ///
        /// [`get_node_secret`]: KeysInterface::get_node_secret
        fn get_node_id(&self, recipient: Recipient) -> Result<PublicKey, ()> {
                let secp_ctx = Secp256k1::signing_only();
@@ -427,6 +431,8 @@ pub trait KeysInterface {
        /// one is provided. Note that this tweak can be applied to `other_key` instead of our node
        /// secret, though this is less efficient.
        ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
+       ///
        /// [`node secret`]: Self::get_node_secret
        fn ecdh(&self, recipient: Recipient, other_key: &PublicKey, tweak: Option<&Scalar>) -> Result<SharedSecret, ()>;
        /// Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
@@ -466,6 +472,8 @@ pub trait KeysInterface {
        /// The hrp is ascii bytes, while the invoice data is base32.
        ///
        /// The secret key used to sign the invoice is dependent on the [`Recipient`].
+       ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
        fn sign_invoice(&self, hrp_bytes: &[u8], invoice_data: &[u5], receipient: Recipient) -> Result<RecoverableSignature, ()>;
 
        /// Get secret key material as bytes for use in encrypting and decrypting inbound payment data.