From aa67f10162a26f8c0d4a0587197d20f6cd843ceb Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 13 Sep 2020 22:49:52 +0200 Subject: [PATCH 1/2] Introducing `bip32::KeySource`: wrapper for `(Fingerprint, DerivationPath)` --- src/util/bip32.rs | 5 +++++ src/util/psbt/map/input.rs | 8 ++++---- src/util/psbt/map/output.rs | 8 ++++---- src/util/psbt/mod.rs | 6 +++--- src/util/psbt/serialize.rs | 8 ++++---- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/util/bip32.rs b/src/util/bip32.rs index 3fd8fc2b..060a55ad 100644 --- a/src/util/bip32.rs +++ b/src/util/bip32.rs @@ -345,6 +345,11 @@ impl fmt::Debug for DerivationPath { } } +/// Full information on the used extended public key: fingerprint of the +/// master extended public key and a derivation path from it. +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +pub struct KeySource(pub Fingerprint, pub DerivationPath); + /// A BIP32 error #[derive(Clone, PartialEq, Eq, Debug)] pub enum Error { diff --git a/src/util/psbt/map/input.rs b/src/util/psbt/map/input.rs index 05a24432..72f33942 100644 --- a/src/util/psbt/map/input.rs +++ b/src/util/psbt/map/input.rs @@ -17,7 +17,7 @@ use std::collections::BTreeMap; use blockdata::script::Script; use blockdata::transaction::{SigHashType, Transaction, TxOut}; use consensus::encode; -use util::bip32::{DerivationPath, Fingerprint}; +use util::bip32::KeySource; use util::key::PublicKey; use util::psbt; use util::psbt::map::Map; @@ -48,7 +48,7 @@ pub struct Input { pub witness_script: Option