psbt: Use new `derive_xpriv` flexibility in GetKey
This commit is contained in:
parent
bd3f4b6bf1
commit
352712257e
|
@ -21,7 +21,7 @@ use std::collections::{HashMap, HashSet};
|
|||
use internals::write_err;
|
||||
use secp256k1::{Keypair, Message, Secp256k1, Signing, Verification};
|
||||
|
||||
use crate::bip32::{self, DerivationPath, KeySource, Xpriv, Xpub};
|
||||
use crate::bip32::{self, KeySource, Xpriv, Xpub};
|
||||
use crate::crypto::key::{PrivateKey, PublicKey};
|
||||
use crate::crypto::{ecdsa, taproot};
|
||||
use crate::key::{TapTweak, XOnlyPublicKey};
|
||||
|
@ -820,8 +820,7 @@ impl GetKey for Xpriv {
|
|||
&& !path.is_empty()
|
||||
&& path[0] == self.child_number
|
||||
{
|
||||
let path = DerivationPath::from_iter(path.into_iter().skip(1).copied());
|
||||
let k = self.derive_xpriv(secp, &path).map_err(GetKeyError::Bip32)?;
|
||||
let k = self.derive_xpriv(secp, &path[1..]).map_err(GetKeyError::Bip32)?;
|
||||
Some(k.to_private_key())
|
||||
} else {
|
||||
None
|
||||
|
@ -1330,7 +1329,7 @@ mod tests {
|
|||
#[cfg(feature = "rand-std")]
|
||||
use {
|
||||
crate::address::script_pubkey::ScriptBufExt as _,
|
||||
crate::bip32::{DerivationPath, Fingerprint},
|
||||
crate::bip32::Fingerprint,
|
||||
crate::locktime,
|
||||
crate::witness_version::WitnessVersion,
|
||||
crate::WitnessProgram,
|
||||
|
@ -1339,7 +1338,7 @@ mod tests {
|
|||
|
||||
use super::*;
|
||||
use crate::address::script_pubkey::ScriptExt as _;
|
||||
use crate::bip32::ChildNumber;
|
||||
use crate::bip32::{ChildNumber, DerivationPath};
|
||||
use crate::locktime::absolute;
|
||||
use crate::network::NetworkKind;
|
||||
use crate::psbt::serialize::{Deserialize, Serialize};
|
||||
|
|
Loading…
Reference in New Issue