Skip to content

Commit

Permalink
Revert "Remove unnecessary m/ prefix requirement"
Browse files Browse the repository at this point in the history
This reverts commit ccbd09d.

There were merits to the change in rust-bitcoin#2451, and the bip is somewhat
unclear on the matter, however the change breaks our ability to parse
output from Bitcoin Core RPC call `getaddressinfo`.

For the release to progress we need to revert this change.
  • Loading branch information
tcharding committed Apr 8, 2024
1 parent 163bf64 commit 9ba3bc4
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 76 deletions.
2 changes: 1 addition & 1 deletion bitcoin/examples/bip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn main() {
println!("Root key: {}", root);

// derive child xpub
let path = DerivationPath::from_str("84h/0h/0h").unwrap();
let path = DerivationPath::from_str("m/84h/0h/0h").unwrap();
let child = root.derive_priv(&secp, &path).unwrap();
println!("Child at {}: {}", path, child);
let xpub = Xpub::from_priv(&secp, &child);
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/examples/ecdsa-psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const INPUT_UTXO_SCRIPT_PUBKEY: &str = "00149891eeb8891b3e80a2a1ade180f143add23b
const INPUT_UTXO_VALUE: &str = "50 BTC";
// Get this from the desciptor,
// "wpkh([97f17dca/0'/0'/0']02749483607dafb30c66bd93ece4474be65745ce538c2d70e8e246f17e7a4e0c0c)#m9n56cx0".
const INPUT_UTXO_DERIVATION_PATH: &str = "0h/0h/0h";
const INPUT_UTXO_DERIVATION_PATH: &str = "m/0h/0h/0h";

// Grab an address to receive on: `bt generatenewaddress` (obviously contrived but works as an example).
const RECEIVE_ADDRESS: &str = "bcrt1qcmnpjjjw78yhyjrxtql6lk7pzpujs3h244p7ae"; // The address to receive the coins we send.
Expand Down Expand Up @@ -115,7 +115,7 @@ impl ColdStorage {

// Hardened children require secret data to derive.

let path = "84h/0h/0h".into_derivation_path()?;
let path = "m/84h/0h/0h".into_derivation_path()?;
let account_0_xpriv = master_xpriv.derive_priv(secp, &path)?;
let account_0_xpub = Xpub::from_priv(secp, &account_0_xpriv);

Expand Down
6 changes: 3 additions & 3 deletions bitcoin/examples/taproot-psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// The xpriv and derivation path from the imported descriptors
const BENEFACTOR_XPRIV_STR: &str = "tprv8ZgxMBicQKsPd4arFr7sKjSnKFDVMR2JHw9Y8L9nXN4kiok4u28LpHijEudH3mMYoL4pM5UL9Bgdz2M4Cy8EzfErmU9m86ZTw6hCzvFeTg7";
const BENEFICIARY_XPRIV_STR: &str = "tprv8ZgxMBicQKsPe72C5c3cugP8b7AzEuNjP4NSC17Dkpqk5kaAmsL6FHwPsVxPpURVqbNwdLAbNqi8Cvdq6nycDwYdKHDjDRYcsMzfshimAUq";
const BIP86_DERIVATION_PATH: &str = "86'/1'/0'/0/0";
const BIP86_DERIVATION_PATH: &str = "m/86'/1'/0'/0/0";

// Step 3 -
// Run `bt generatetoaddress 103 $(bt-benefactor getnewaddress '' bech32m)` to generate 103 new blocks
Expand Down Expand Up @@ -389,7 +389,7 @@ impl BenefactorWallet {
}
// We use some other derivation path in this example for our inheritance protocol. The important thing is to ensure
// that we use an unhardened path so we can make use of xpubs.
let derivation_path = DerivationPath::from_str(&format!("101/1/0/0/{}", self.next))?;
let derivation_path = DerivationPath::from_str(&format!("m/101/1/0/0/{}", self.next))?;
let internal_keypair =
self.master_xpriv.derive_priv(&self.secp, &derivation_path)?.to_keypair(&self.secp);
let beneficiary_key =
Expand Down Expand Up @@ -478,7 +478,7 @@ impl BenefactorWallet {
// We use some other derivation path in this example for our inheritance protocol. The important thing is to ensure
// that we use an unhardened path so we can make use of xpubs.
let new_derivation_path =
DerivationPath::from_str(&format!("101/1/0/0/{}", self.next))?;
DerivationPath::from_str(&format!("m/101/1/0/0/{}", self.next))?;
let new_internal_keypair = self
.master_xpriv
.derive_priv(&self.secp, &new_derivation_path)?
Expand Down
113 changes: 56 additions & 57 deletions bitcoin/src/bip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,13 @@ impl FromStr for DerivationPath {
type Err = Error;

fn from_str(path: &str) -> Result<DerivationPath, Error> {
let ret: Result<Vec<ChildNumber>, Error> = if path.is_empty() {
Ok(vec![])
} else {
let parts = path.split('/');
parts.map(str::parse).collect()
};
let mut parts = path.split('/');
// First parts must be `m`.
if parts.next().unwrap() != "m" {
return Err(Error::InvalidDerivationPathFormat);
}

let ret: Result<Vec<ChildNumber>, Error> = parts.map(str::parse).collect();
Ok(DerivationPath(ret?))
}
}
Expand Down Expand Up @@ -412,9 +413,9 @@ impl DerivationPath {
/// use bitcoin::bip32::{DerivationPath, ChildNumber};
/// use std::str::FromStr;
///
/// let base = DerivationPath::from_str("42").unwrap();
/// let base = DerivationPath::from_str("m/42").unwrap();
///
/// let deriv_1 = base.extend(DerivationPath::from_str("0/1").unwrap());
/// let deriv_1 = base.extend(DerivationPath::from_str("m/0/1").unwrap());
/// let deriv_2 = base.extend(&[
/// ChildNumber::from_normal_idx(0).unwrap(),
/// ChildNumber::from_normal_idx(1).unwrap()
Expand All @@ -436,7 +437,7 @@ impl DerivationPath {
/// use bitcoin::bip32::DerivationPath;
/// use std::str::FromStr;
///
/// let path = DerivationPath::from_str("84'/0'/0'/0/1").unwrap();
/// let path = DerivationPath::from_str("m/84'/0'/0'/0/1").unwrap();
/// const HARDENED: u32 = 0x80000000;
/// assert_eq!(path.to_u32_vec(), vec![84 + HARDENED, HARDENED, HARDENED, 0, 1]);
/// ```
Expand All @@ -445,13 +446,10 @@ impl DerivationPath {

impl fmt::Display for DerivationPath {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut iter = self.0.iter();
if let Some(first_element) = iter.next() {
write!(f, "{}", first_element)?;
}
for cn in iter {
f.write_str("m")?;
for cn in self.0.iter() {
f.write_str("/")?;
write!(f, "{}", cn)?;
fmt::Display::fmt(cn, f)?;
}
Ok(())
}
Expand Down Expand Up @@ -905,32 +903,33 @@ mod tests {

#[test]
fn test_parse_derivation_path() {
assert_eq!(DerivationPath::from_str("n/0'/0"), Err(Error::InvalidChildNumberFormat));
assert_eq!(DerivationPath::from_str("4/m/5"), Err(Error::InvalidChildNumberFormat));
assert_eq!(DerivationPath::from_str("//3/0'"), Err(Error::InvalidChildNumberFormat));
assert_eq!(DerivationPath::from_str("0h/0x"), Err(Error::InvalidChildNumberFormat));
assert_eq!(DerivationPath::from_str("42"), Err(Error::InvalidDerivationPathFormat));
assert_eq!(DerivationPath::from_str("n/0'/0"), Err(Error::InvalidDerivationPathFormat));
assert_eq!(DerivationPath::from_str("4/m/5"), Err(Error::InvalidDerivationPathFormat));
assert_eq!(DerivationPath::from_str("m//3/0'"), Err(Error::InvalidChildNumberFormat));
assert_eq!(DerivationPath::from_str("m/0h/0x"), Err(Error::InvalidChildNumberFormat));
assert_eq!(
DerivationPath::from_str("2147483648"),
DerivationPath::from_str("m/2147483648"),
Err(Error::InvalidChildNumber(2147483648))
);

assert_eq!(DerivationPath::master(), DerivationPath::from_str("").unwrap());
assert_eq!(DerivationPath::master(), DerivationPath::from_str("m").unwrap());
assert_eq!(DerivationPath::master(), DerivationPath::default());
assert_eq!(DerivationPath::from_str("m"), Err(Error::InvalidChildNumberFormat));
assert_eq!(DerivationPath::from_str("m"), Ok(vec![].into()));
assert_eq!(
DerivationPath::from_str("0'"),
DerivationPath::from_str("m/0'"),
Ok(vec![ChildNumber::from_hardened_idx(0).unwrap()].into())
);
assert_eq!(
DerivationPath::from_str("0'/1"),
DerivationPath::from_str("m/0'/1"),
Ok(vec![
ChildNumber::from_hardened_idx(0).unwrap(),
ChildNumber::from_normal_idx(1).unwrap()
]
.into())
);
assert_eq!(
DerivationPath::from_str("0h/1/2'"),
DerivationPath::from_str("m/0h/1/2'"),
Ok(vec![
ChildNumber::from_hardened_idx(0).unwrap(),
ChildNumber::from_normal_idx(1).unwrap(),
Expand All @@ -939,7 +938,7 @@ mod tests {
.into())
);
assert_eq!(
DerivationPath::from_str("0'/1/2h/2"),
DerivationPath::from_str("m/0'/1/2h/2"),
Ok(vec![
ChildNumber::from_hardened_idx(0).unwrap(),
ChildNumber::from_normal_idx(1).unwrap(),
Expand All @@ -949,7 +948,7 @@ mod tests {
.into())
);
assert_eq!(
DerivationPath::from_str("0'/1/2'/2/1000000000"),
DerivationPath::from_str("m/0'/1/2'/2/1000000000"),
Ok(vec![
ChildNumber::from_hardened_idx(0).unwrap(),
ChildNumber::from_normal_idx(1).unwrap(),
Expand All @@ -959,14 +958,14 @@ mod tests {
]
.into())
);
let s = "0'/50/3'/5/545456";
let s = "m/0'/50/3'/5/545456";
assert_eq!(DerivationPath::from_str(s), s.into_derivation_path());
assert_eq!(DerivationPath::from_str(s), s.to_string().into_derivation_path());
}

#[test]
fn test_derivation_path_conversion_index() {
let path = DerivationPath::from_str("0h/1/2'").unwrap();
let path = DerivationPath::from_str("m/0h/1/2'").unwrap();
let numbers: Vec<ChildNumber> = path.clone().into();
let path2: DerivationPath = numbers.into();
assert_eq!(path, path2);
Expand All @@ -975,7 +974,7 @@ mod tests {
&[ChildNumber::from_hardened_idx(0).unwrap(), ChildNumber::from_normal_idx(1).unwrap()]
);
let indexed: DerivationPath = path[..2].into();
assert_eq!(indexed, DerivationPath::from_str("0h/1").unwrap());
assert_eq!(indexed, DerivationPath::from_str("m/0h/1").unwrap());
assert_eq!(indexed.child(ChildNumber::from_hardened_idx(2).unwrap()), path);
}

Expand Down Expand Up @@ -1042,29 +1041,29 @@ mod tests {
assert_eq!(cn.increment().err(), Some(Error::InvalidChildNumber(1 << 31)));

let cn = ChildNumber::from_normal_idx(350).unwrap();
let path = DerivationPath::from_str("42'").unwrap();
let path = DerivationPath::from_str("m/42'").unwrap();
let mut iter = path.children_from(cn);
assert_eq!(iter.next(), Some("42'/350".parse().unwrap()));
assert_eq!(iter.next(), Some("42'/351".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/350".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/351".parse().unwrap()));

let path = DerivationPath::from_str("42'/350'").unwrap();
let path = DerivationPath::from_str("m/42'/350'").unwrap();
let mut iter = path.normal_children();
assert_eq!(iter.next(), Some("42'/350'/0".parse().unwrap()));
assert_eq!(iter.next(), Some("42'/350'/1".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/350'/0".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/350'/1".parse().unwrap()));

let path = DerivationPath::from_str("42'/350'").unwrap();
let path = DerivationPath::from_str("m/42'/350'").unwrap();
let mut iter = path.hardened_children();
assert_eq!(iter.next(), Some("42'/350'/0'".parse().unwrap()));
assert_eq!(iter.next(), Some("42'/350'/1'".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/350'/0'".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/350'/1'".parse().unwrap()));

let cn = ChildNumber::from_hardened_idx(42350).unwrap();
let path = DerivationPath::from_str("42'").unwrap();
let path = DerivationPath::from_str("m/42'").unwrap();
let mut iter = path.children_from(cn);
assert_eq!(iter.next(), Some("42'/42350'".parse().unwrap()));
assert_eq!(iter.next(), Some("42'/42351'".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/42350'".parse().unwrap()));
assert_eq!(iter.next(), Some("m/42'/42351'".parse().unwrap()));

let cn = ChildNumber::from_hardened_idx(max).unwrap();
let path = DerivationPath::from_str("42'").unwrap();
let path = DerivationPath::from_str("m/42'").unwrap();
let mut iter = path.children_from(cn);
assert!(iter.next().is_some());
assert!(iter.next().is_none());
Expand All @@ -1076,32 +1075,32 @@ mod tests {
let seed = hex!("000102030405060708090a0b0c0d0e0f");

// m
test_path(&secp, NetworkKind::Main, &seed, "".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m".parse().unwrap(),
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
"xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8");

// m/0h
test_path(&secp, NetworkKind::Main, &seed, "0h".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0h".parse().unwrap(),
"xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7",
"xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw");

// m/0h/1
test_path(&secp, NetworkKind::Main, &seed, "0h/1".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1".parse().unwrap(),
"xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs",
"xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47sSikHjJf3UFHKkNAWbWMiGj7Wf5uMash7SyYq527Hqck2AxYysAA7xmALppuCkwQ");

// m/0h/1/2h
test_path(&secp, NetworkKind::Main, &seed, "0h/1/2h".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1/2h".parse().unwrap(),
"xprv9z4pot5VBttmtdRTWfWQmoH1taj2axGVzFqSb8C9xaxKymcFzXBDptWmT7FwuEzG3ryjH4ktypQSAewRiNMjANTtpgP4mLTj34bhnZX7UiM",
"xpub6D4BDPcP2GT577Vvch3R8wDkScZWzQzMMUm3PWbmWvVJrZwQY4VUNgqFJPMM3No2dFDFGTsxxpG5uJh7n7epu4trkrX7x7DogT5Uv6fcLW5");

// m/0h/1/2h/2
test_path(&secp, NetworkKind::Main, &seed, "0h/1/2h/2".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1/2h/2".parse().unwrap(),
"xprvA2JDeKCSNNZky6uBCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334",
"xpub6FHa3pjLCk84BayeJxFW2SP4XRrFd1JYnxeLeU8EqN3vDfZmbqBqaGJAyiLjTAwm6ZLRQUMv1ZACTj37sR62cfN7fe5JnJ7dh8zL4fiyLHV");

// m/0h/1/2h/2/1000000000
test_path(&secp, NetworkKind::Main, &seed, "0h/1/2h/2/1000000000".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1/2h/2/1000000000".parse().unwrap(),
"xprvA41z7zogVVwxVSgdKUHDy1SKmdb533PjDz7J6N6mV6uS3ze1ai8FHa8kmHScGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76",
"xpub6H1LXWLaKsWFhvm6RVpEL9P4KfRZSW7abD2ttkWP3SSQvnyA8FSVqNTEcYFgJS2UaFcxupHiYkro49S8yGasTvXEYBVPamhGW6cFJodrTHy");
}
Expand All @@ -1112,32 +1111,32 @@ mod tests {
let seed = hex!("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542");

// m
test_path(&secp, NetworkKind::Main, &seed, "".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m".parse().unwrap(),
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
"xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB");

// m/0
test_path(&secp, NetworkKind::Main, &seed, "0".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0".parse().unwrap(),
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt",
"xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH");

// m/0/2147483647h
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h".parse().unwrap(),
"xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcEPdU9",
"xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85ySDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNnBC5y4a");

// m/0/2147483647h/1
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h/1".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h/1".parse().unwrap(),
"xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25UEPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKADdw4Ef",
"xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvmdMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2dhHKon");

// m/0/2147483647h/1/2147483646h
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h/1/2147483646h".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h/1/2147483646h".parse().unwrap(),
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc",
"xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL");

// m/0/2147483647h/1/2147483646h/2
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h/1/2147483646h/2".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h/1/2147483646h/2".parse().unwrap(),
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
"xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt");
}
Expand All @@ -1148,12 +1147,12 @@ mod tests {
let seed = hex!("4b381541583be4423346c643850da4b320e46a87ae3d2a4e6da11eba819cd4acba45d239319ac14f863b8d5ab5a0d0c64d2e8a1e7d1457df2e5a3c51c73235be");

// m
test_path(&secp, NetworkKind::Main, &seed, "".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m".parse().unwrap(),
"xprv9s21ZrQH143K25QhxbucbDDuQ4naNntJRi4KUfWT7xo4EKsHt2QJDu7KXp1A3u7Bi1j8ph3EGsZ9Xvz9dGuVrtHHs7pXeTzjuxBrCmmhgC6",
"xpub661MyMwAqRbcEZVB4dScxMAdx6d4nFc9nvyvH3v4gJL378CSRZiYmhRoP7mBy6gSPSCYk6SzXPTf3ND1cZAceL7SfJ1Z3GC8vBgp2epUt13");

// m/0h
test_path(&secp, NetworkKind::Main, &seed, "0h".parse().unwrap(),
test_path(&secp, NetworkKind::Main, &seed, "m/0h".parse().unwrap(),
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
"xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y");
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/src/psbt/map/global.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC0-1.0

use io::{BufRead, Cursor, Read};
use io::{Cursor, BufRead, Read};

use crate::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpub};
use crate::blockdata::transaction::Transaction;
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/src/psbt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ mod tests {
vec![(raw::Key { type_value: 1, key: vec![0, 1] }, vec![3, 4, 5])]
.into_iter()
.collect();
let key_source = ("deadbeef".parse().unwrap(), "0'/1".parse().unwrap());
let key_source = ("deadbeef".parse().unwrap(), "m/0'/1".parse().unwrap());
let keypaths: BTreeMap<secp256k1::PublicKey, KeySource> = vec![(
"0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(),
key_source.clone(),
Expand Down
Loading

0 comments on commit 9ba3bc4

Please sign in to comment.