From 3d9acd2231a4a7560dcd871d1476831b2e6b0531 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Fri, 11 Oct 2024 02:47:00 +0300 Subject: [PATCH] Document an error case for at_derivation_index() --- src/descriptor/key.rs | 1 + src/descriptor/mod.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/descriptor/key.rs b/src/descriptor/key.rs index 7e034ef99..bafe4c2d6 100644 --- a/src/descriptor/key.rs +++ b/src/descriptor/key.rs @@ -627,6 +627,7 @@ impl DescriptorPublicKey { /// # Errors /// /// - If `index` is hardened. + /// - If the key contains multi-path derivations pub fn at_derivation_index(self, index: u32) -> Result { let definite = match self { DescriptorPublicKey::Single(_) => self, diff --git a/src/descriptor/mod.rs b/src/descriptor/mod.rs index 487bbcc45..862fc58c6 100644 --- a/src/descriptor/mod.rs +++ b/src/descriptor/mod.rs @@ -596,6 +596,7 @@ impl Descriptor { /// /// # Errors /// - If index ≥ 2^31 + /// - If the descriptor contains multi-path derivations pub fn at_derivation_index( &self, index: u32, @@ -650,7 +651,8 @@ impl Descriptor { /// /// # Errors /// - /// This function will return an error if hardened derivation is attempted. + /// This function will return an error for multi-path descriptors + /// or if hardened derivation is attempted, pub fn derived_descriptor( &self, secp: &secp256k1::Secp256k1,