Merge rust-bitcoin/rust-bitcoin#2451: Remove m prefix requirement
ccbd09d5fb
Remove unnecessary m/ prefix requirement (josibake) Pull request description: `m` in BIP0032 is a variable, not a constant. Requiring it as a constant here is confusing and can lead to erroneous conclusions if using this library as a means of understanding BIP0032. Fixes #2449 ACKs for top commit: Kixunil: ACKccbd09d5fb
apoelstra: ACKccbd09d5fb
Tree-SHA512: b641679f958f20a51c1890b23bbaa0153716802d6180dfd1f649e104f291c5a99143e02b75d292b22254201b28e5c53a04ecd7b6a88ff6f964073106419c5ec1
This commit is contained in:
commit
94c6526dbe
|
@ -40,7 +40,7 @@ fn main() {
|
||||||
println!("Root key: {}", root);
|
println!("Root key: {}", root);
|
||||||
|
|
||||||
// derive child xpub
|
// derive child xpub
|
||||||
let path = DerivationPath::from_str("m/84h/0h/0h").unwrap();
|
let path = DerivationPath::from_str("84h/0h/0h").unwrap();
|
||||||
let child = root.derive_priv(&secp, &path).unwrap();
|
let child = root.derive_priv(&secp, &path).unwrap();
|
||||||
println!("Child at {}: {}", path, child);
|
println!("Child at {}: {}", path, child);
|
||||||
let xpub = Xpub::from_priv(&secp, &child);
|
let xpub = Xpub::from_priv(&secp, &child);
|
||||||
|
|
|
@ -55,7 +55,7 @@ const INPUT_UTXO_SCRIPT_PUBKEY: &str = "00149891eeb8891b3e80a2a1ade180f143add23b
|
||||||
const INPUT_UTXO_VALUE: &str = "50 BTC";
|
const INPUT_UTXO_VALUE: &str = "50 BTC";
|
||||||
// Get this from the desciptor,
|
// Get this from the desciptor,
|
||||||
// "wpkh([97f17dca/0'/0'/0']02749483607dafb30c66bd93ece4474be65745ce538c2d70e8e246f17e7a4e0c0c)#m9n56cx0".
|
// "wpkh([97f17dca/0'/0'/0']02749483607dafb30c66bd93ece4474be65745ce538c2d70e8e246f17e7a4e0c0c)#m9n56cx0".
|
||||||
const INPUT_UTXO_DERIVATION_PATH: &str = "m/0h/0h/0h";
|
const INPUT_UTXO_DERIVATION_PATH: &str = "0h/0h/0h";
|
||||||
|
|
||||||
// Grab an address to receive on: `bt generatenewaddress` (obviously contrived but works as an example).
|
// 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.
|
const RECEIVE_ADDRESS: &str = "bcrt1qcmnpjjjw78yhyjrxtql6lk7pzpujs3h244p7ae"; // The address to receive the coins we send.
|
||||||
|
@ -116,7 +116,7 @@ impl ColdStorage {
|
||||||
|
|
||||||
// Hardened children require secret data to derive.
|
// Hardened children require secret data to derive.
|
||||||
|
|
||||||
let path = "m/84h/0h/0h".into_derivation_path()?;
|
let path = "84h/0h/0h".into_derivation_path()?;
|
||||||
let account_0_xpriv = master_xpriv.derive_priv(secp, &path)?;
|
let account_0_xpriv = master_xpriv.derive_priv(secp, &path)?;
|
||||||
let account_0_xpub = Xpub::from_priv(secp, &account_0_xpriv);
|
let account_0_xpub = Xpub::from_priv(secp, &account_0_xpriv);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
// The xpriv and derivation path from the imported descriptors
|
// The xpriv and derivation path from the imported descriptors
|
||||||
const BENEFACTOR_XPRIV_STR: &str = "tprv8ZgxMBicQKsPd4arFr7sKjSnKFDVMR2JHw9Y8L9nXN4kiok4u28LpHijEudH3mMYoL4pM5UL9Bgdz2M4Cy8EzfErmU9m86ZTw6hCzvFeTg7";
|
const BENEFACTOR_XPRIV_STR: &str = "tprv8ZgxMBicQKsPd4arFr7sKjSnKFDVMR2JHw9Y8L9nXN4kiok4u28LpHijEudH3mMYoL4pM5UL9Bgdz2M4Cy8EzfErmU9m86ZTw6hCzvFeTg7";
|
||||||
const BENEFICIARY_XPRIV_STR: &str = "tprv8ZgxMBicQKsPe72C5c3cugP8b7AzEuNjP4NSC17Dkpqk5kaAmsL6FHwPsVxPpURVqbNwdLAbNqi8Cvdq6nycDwYdKHDjDRYcsMzfshimAUq";
|
const BENEFICIARY_XPRIV_STR: &str = "tprv8ZgxMBicQKsPe72C5c3cugP8b7AzEuNjP4NSC17Dkpqk5kaAmsL6FHwPsVxPpURVqbNwdLAbNqi8Cvdq6nycDwYdKHDjDRYcsMzfshimAUq";
|
||||||
const BIP86_DERIVATION_PATH: &str = "m/86'/1'/0'/0/0";
|
const BIP86_DERIVATION_PATH: &str = "86'/1'/0'/0/0";
|
||||||
|
|
||||||
// Step 3 -
|
// Step 3 -
|
||||||
// Run `bt generatetoaddress 103 $(bt-benefactor getnewaddress '' bech32m)` to generate 103 new blocks
|
// Run `bt generatetoaddress 103 $(bt-benefactor getnewaddress '' bech32m)` to generate 103 new blocks
|
||||||
|
@ -390,7 +390,7 @@ impl BenefactorWallet {
|
||||||
}
|
}
|
||||||
// We use some other derivation path in this example for our inheritance protocol. The important thing is to ensure
|
// 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.
|
// that we use an unhardened path so we can make use of xpubs.
|
||||||
let derivation_path = DerivationPath::from_str(&format!("m/101/1/0/0/{}", self.next))?;
|
let derivation_path = DerivationPath::from_str(&format!("101/1/0/0/{}", self.next))?;
|
||||||
let internal_keypair =
|
let internal_keypair =
|
||||||
self.master_xpriv.derive_priv(&self.secp, &derivation_path)?.to_keypair(&self.secp);
|
self.master_xpriv.derive_priv(&self.secp, &derivation_path)?.to_keypair(&self.secp);
|
||||||
let beneficiary_key =
|
let beneficiary_key =
|
||||||
|
@ -479,7 +479,7 @@ impl BenefactorWallet {
|
||||||
// We use some other derivation path in this example for our inheritance protocol. The important thing is to ensure
|
// 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.
|
// that we use an unhardened path so we can make use of xpubs.
|
||||||
let new_derivation_path =
|
let new_derivation_path =
|
||||||
DerivationPath::from_str(&format!("m/101/1/0/0/{}", self.next))?;
|
DerivationPath::from_str(&format!("101/1/0/0/{}", self.next))?;
|
||||||
let new_internal_keypair = self
|
let new_internal_keypair = self
|
||||||
.master_xpriv
|
.master_xpriv
|
||||||
.derive_priv(&self.secp, &new_derivation_path)?
|
.derive_priv(&self.secp, &new_derivation_path)?
|
||||||
|
|
|
@ -330,13 +330,12 @@ impl FromStr for DerivationPath {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn from_str(path: &str) -> Result<DerivationPath, Error> {
|
fn from_str(path: &str) -> Result<DerivationPath, Error> {
|
||||||
let mut parts = path.split('/');
|
let ret: Result<Vec<ChildNumber>, Error> = if path.is_empty() {
|
||||||
// First parts must be `m`.
|
Ok(vec![])
|
||||||
if parts.next().unwrap() != "m" {
|
} else {
|
||||||
return Err(Error::InvalidDerivationPathFormat);
|
let parts = path.split('/');
|
||||||
}
|
parts.map(str::parse).collect()
|
||||||
|
};
|
||||||
let ret: Result<Vec<ChildNumber>, Error> = parts.map(str::parse).collect();
|
|
||||||
Ok(DerivationPath(ret?))
|
Ok(DerivationPath(ret?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,9 +416,9 @@ impl DerivationPath {
|
||||||
/// use bitcoin::bip32::{DerivationPath, ChildNumber};
|
/// use bitcoin::bip32::{DerivationPath, ChildNumber};
|
||||||
/// use std::str::FromStr;
|
/// use std::str::FromStr;
|
||||||
///
|
///
|
||||||
/// let base = DerivationPath::from_str("m/42").unwrap();
|
/// let base = DerivationPath::from_str("42").unwrap();
|
||||||
///
|
///
|
||||||
/// let deriv_1 = base.extend(DerivationPath::from_str("m/0/1").unwrap());
|
/// let deriv_1 = base.extend(DerivationPath::from_str("0/1").unwrap());
|
||||||
/// let deriv_2 = base.extend(&[
|
/// let deriv_2 = base.extend(&[
|
||||||
/// ChildNumber::from_normal_idx(0).unwrap(),
|
/// ChildNumber::from_normal_idx(0).unwrap(),
|
||||||
/// ChildNumber::from_normal_idx(1).unwrap()
|
/// ChildNumber::from_normal_idx(1).unwrap()
|
||||||
|
@ -441,7 +440,7 @@ impl DerivationPath {
|
||||||
/// use bitcoin::bip32::DerivationPath;
|
/// use bitcoin::bip32::DerivationPath;
|
||||||
/// use std::str::FromStr;
|
/// use std::str::FromStr;
|
||||||
///
|
///
|
||||||
/// let path = DerivationPath::from_str("m/84'/0'/0'/0/1").unwrap();
|
/// let path = DerivationPath::from_str("84'/0'/0'/0/1").unwrap();
|
||||||
/// const HARDENED: u32 = 0x80000000;
|
/// const HARDENED: u32 = 0x80000000;
|
||||||
/// assert_eq!(path.to_u32_vec(), vec![84 + HARDENED, HARDENED, HARDENED, 0, 1]);
|
/// assert_eq!(path.to_u32_vec(), vec![84 + HARDENED, HARDENED, HARDENED, 0, 1]);
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -450,10 +449,13 @@ impl DerivationPath {
|
||||||
|
|
||||||
impl fmt::Display for DerivationPath {
|
impl fmt::Display for DerivationPath {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
f.write_str("m")?;
|
let mut iter = self.0.iter();
|
||||||
for cn in self.0.iter() {
|
if let Some(first_element) = iter.next() {
|
||||||
|
write!(f, "{}", first_element)?;
|
||||||
|
}
|
||||||
|
for cn in iter {
|
||||||
f.write_str("/")?;
|
f.write_str("/")?;
|
||||||
fmt::Display::fmt(cn, f)?;
|
write!(f, "{}", cn)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -887,25 +889,24 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_derivation_path() {
|
fn test_parse_derivation_path() {
|
||||||
assert_eq!(DerivationPath::from_str("42"), Err(Error::InvalidDerivationPathFormat));
|
assert_eq!(DerivationPath::from_str("n/0'/0"), Err(Error::InvalidChildNumberFormat));
|
||||||
assert_eq!(DerivationPath::from_str("n/0'/0"), Err(Error::InvalidDerivationPathFormat));
|
assert_eq!(DerivationPath::from_str("4/m/5"), Err(Error::InvalidChildNumberFormat));
|
||||||
assert_eq!(DerivationPath::from_str("4/m/5"), Err(Error::InvalidDerivationPathFormat));
|
assert_eq!(DerivationPath::from_str("//3/0'"), Err(Error::InvalidChildNumberFormat));
|
||||||
assert_eq!(DerivationPath::from_str("m//3/0'"), Err(Error::InvalidChildNumberFormat));
|
assert_eq!(DerivationPath::from_str("0h/0x"), Err(Error::InvalidChildNumberFormat));
|
||||||
assert_eq!(DerivationPath::from_str("m/0h/0x"), Err(Error::InvalidChildNumberFormat));
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DerivationPath::from_str("m/2147483648"),
|
DerivationPath::from_str("2147483648"),
|
||||||
Err(Error::InvalidChildNumber(2147483648))
|
Err(Error::InvalidChildNumber(2147483648))
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(DerivationPath::master(), DerivationPath::from_str("m").unwrap());
|
assert_eq!(DerivationPath::master(), DerivationPath::from_str("").unwrap());
|
||||||
assert_eq!(DerivationPath::master(), DerivationPath::default());
|
assert_eq!(DerivationPath::master(), DerivationPath::default());
|
||||||
assert_eq!(DerivationPath::from_str("m"), Ok(vec![].into()));
|
assert_eq!(DerivationPath::from_str("m"), Err(Error::InvalidChildNumberFormat));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DerivationPath::from_str("m/0'"),
|
DerivationPath::from_str("0'"),
|
||||||
Ok(vec![ChildNumber::from_hardened_idx(0).unwrap()].into())
|
Ok(vec![ChildNumber::from_hardened_idx(0).unwrap()].into())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DerivationPath::from_str("m/0'/1"),
|
DerivationPath::from_str("0'/1"),
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
ChildNumber::from_hardened_idx(0).unwrap(),
|
ChildNumber::from_hardened_idx(0).unwrap(),
|
||||||
ChildNumber::from_normal_idx(1).unwrap()
|
ChildNumber::from_normal_idx(1).unwrap()
|
||||||
|
@ -913,7 +914,7 @@ mod tests {
|
||||||
.into())
|
.into())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DerivationPath::from_str("m/0h/1/2'"),
|
DerivationPath::from_str("0h/1/2'"),
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
ChildNumber::from_hardened_idx(0).unwrap(),
|
ChildNumber::from_hardened_idx(0).unwrap(),
|
||||||
ChildNumber::from_normal_idx(1).unwrap(),
|
ChildNumber::from_normal_idx(1).unwrap(),
|
||||||
|
@ -922,7 +923,7 @@ mod tests {
|
||||||
.into())
|
.into())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DerivationPath::from_str("m/0'/1/2h/2"),
|
DerivationPath::from_str("0'/1/2h/2"),
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
ChildNumber::from_hardened_idx(0).unwrap(),
|
ChildNumber::from_hardened_idx(0).unwrap(),
|
||||||
ChildNumber::from_normal_idx(1).unwrap(),
|
ChildNumber::from_normal_idx(1).unwrap(),
|
||||||
|
@ -932,7 +933,7 @@ mod tests {
|
||||||
.into())
|
.into())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DerivationPath::from_str("m/0'/1/2'/2/1000000000"),
|
DerivationPath::from_str("0'/1/2'/2/1000000000"),
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
ChildNumber::from_hardened_idx(0).unwrap(),
|
ChildNumber::from_hardened_idx(0).unwrap(),
|
||||||
ChildNumber::from_normal_idx(1).unwrap(),
|
ChildNumber::from_normal_idx(1).unwrap(),
|
||||||
|
@ -942,14 +943,14 @@ mod tests {
|
||||||
]
|
]
|
||||||
.into())
|
.into())
|
||||||
);
|
);
|
||||||
let s = "m/0'/50/3'/5/545456";
|
let s = "0'/50/3'/5/545456";
|
||||||
assert_eq!(DerivationPath::from_str(s), s.into_derivation_path());
|
assert_eq!(DerivationPath::from_str(s), s.into_derivation_path());
|
||||||
assert_eq!(DerivationPath::from_str(s), s.to_string().into_derivation_path());
|
assert_eq!(DerivationPath::from_str(s), s.to_string().into_derivation_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_derivation_path_conversion_index() {
|
fn test_derivation_path_conversion_index() {
|
||||||
let path = DerivationPath::from_str("m/0h/1/2'").unwrap();
|
let path = DerivationPath::from_str("0h/1/2'").unwrap();
|
||||||
let numbers: Vec<ChildNumber> = path.clone().into();
|
let numbers: Vec<ChildNumber> = path.clone().into();
|
||||||
let path2: DerivationPath = numbers.into();
|
let path2: DerivationPath = numbers.into();
|
||||||
assert_eq!(path, path2);
|
assert_eq!(path, path2);
|
||||||
|
@ -958,7 +959,7 @@ mod tests {
|
||||||
&[ChildNumber::from_hardened_idx(0).unwrap(), ChildNumber::from_normal_idx(1).unwrap()]
|
&[ChildNumber::from_hardened_idx(0).unwrap(), ChildNumber::from_normal_idx(1).unwrap()]
|
||||||
);
|
);
|
||||||
let indexed: DerivationPath = path[..2].into();
|
let indexed: DerivationPath = path[..2].into();
|
||||||
assert_eq!(indexed, DerivationPath::from_str("m/0h/1").unwrap());
|
assert_eq!(indexed, DerivationPath::from_str("0h/1").unwrap());
|
||||||
assert_eq!(indexed.child(ChildNumber::from_hardened_idx(2).unwrap()), path);
|
assert_eq!(indexed.child(ChildNumber::from_hardened_idx(2).unwrap()), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,29 +1026,29 @@ mod tests {
|
||||||
assert_eq!(cn.increment().err(), Some(Error::InvalidChildNumber(1 << 31)));
|
assert_eq!(cn.increment().err(), Some(Error::InvalidChildNumber(1 << 31)));
|
||||||
|
|
||||||
let cn = ChildNumber::from_normal_idx(350).unwrap();
|
let cn = ChildNumber::from_normal_idx(350).unwrap();
|
||||||
let path = DerivationPath::from_str("m/42'").unwrap();
|
let path = DerivationPath::from_str("42'").unwrap();
|
||||||
let mut iter = path.children_from(cn);
|
let mut iter = path.children_from(cn);
|
||||||
assert_eq!(iter.next(), Some("m/42'/350".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/350".parse().unwrap()));
|
||||||
assert_eq!(iter.next(), Some("m/42'/351".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/351".parse().unwrap()));
|
||||||
|
|
||||||
let path = DerivationPath::from_str("m/42'/350'").unwrap();
|
let path = DerivationPath::from_str("42'/350'").unwrap();
|
||||||
let mut iter = path.normal_children();
|
let mut iter = path.normal_children();
|
||||||
assert_eq!(iter.next(), Some("m/42'/350'/0".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/350'/0".parse().unwrap()));
|
||||||
assert_eq!(iter.next(), Some("m/42'/350'/1".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/350'/1".parse().unwrap()));
|
||||||
|
|
||||||
let path = DerivationPath::from_str("m/42'/350'").unwrap();
|
let path = DerivationPath::from_str("42'/350'").unwrap();
|
||||||
let mut iter = path.hardened_children();
|
let mut iter = path.hardened_children();
|
||||||
assert_eq!(iter.next(), Some("m/42'/350'/0'".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/350'/0'".parse().unwrap()));
|
||||||
assert_eq!(iter.next(), Some("m/42'/350'/1'".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/350'/1'".parse().unwrap()));
|
||||||
|
|
||||||
let cn = ChildNumber::from_hardened_idx(42350).unwrap();
|
let cn = ChildNumber::from_hardened_idx(42350).unwrap();
|
||||||
let path = DerivationPath::from_str("m/42'").unwrap();
|
let path = DerivationPath::from_str("42'").unwrap();
|
||||||
let mut iter = path.children_from(cn);
|
let mut iter = path.children_from(cn);
|
||||||
assert_eq!(iter.next(), Some("m/42'/42350'".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/42350'".parse().unwrap()));
|
||||||
assert_eq!(iter.next(), Some("m/42'/42351'".parse().unwrap()));
|
assert_eq!(iter.next(), Some("42'/42351'".parse().unwrap()));
|
||||||
|
|
||||||
let cn = ChildNumber::from_hardened_idx(max).unwrap();
|
let cn = ChildNumber::from_hardened_idx(max).unwrap();
|
||||||
let path = DerivationPath::from_str("m/42'").unwrap();
|
let path = DerivationPath::from_str("42'").unwrap();
|
||||||
let mut iter = path.children_from(cn);
|
let mut iter = path.children_from(cn);
|
||||||
assert!(iter.next().is_some());
|
assert!(iter.next().is_some());
|
||||||
assert!(iter.next().is_none());
|
assert!(iter.next().is_none());
|
||||||
|
@ -1059,32 +1060,32 @@ mod tests {
|
||||||
let seed = hex!("000102030405060708090a0b0c0d0e0f");
|
let seed = hex!("000102030405060708090a0b0c0d0e0f");
|
||||||
|
|
||||||
// m
|
// m
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "".parse().unwrap(),
|
||||||
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
|
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
|
||||||
"xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8");
|
"xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8");
|
||||||
|
|
||||||
// m/0h
|
// m/0h
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0h".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0h".parse().unwrap(),
|
||||||
"xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7",
|
"xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7",
|
||||||
"xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw");
|
"xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw");
|
||||||
|
|
||||||
// m/0h/1
|
// m/0h/1
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0h/1".parse().unwrap(),
|
||||||
"xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs",
|
"xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs",
|
||||||
"xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47sSikHjJf3UFHKkNAWbWMiGj7Wf5uMash7SyYq527Hqck2AxYysAA7xmALppuCkwQ");
|
"xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47sSikHjJf3UFHKkNAWbWMiGj7Wf5uMash7SyYq527Hqck2AxYysAA7xmALppuCkwQ");
|
||||||
|
|
||||||
// m/0h/1/2h
|
// m/0h/1/2h
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1/2h".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0h/1/2h".parse().unwrap(),
|
||||||
"xprv9z4pot5VBttmtdRTWfWQmoH1taj2axGVzFqSb8C9xaxKymcFzXBDptWmT7FwuEzG3ryjH4ktypQSAewRiNMjANTtpgP4mLTj34bhnZX7UiM",
|
"xprv9z4pot5VBttmtdRTWfWQmoH1taj2axGVzFqSb8C9xaxKymcFzXBDptWmT7FwuEzG3ryjH4ktypQSAewRiNMjANTtpgP4mLTj34bhnZX7UiM",
|
||||||
"xpub6D4BDPcP2GT577Vvch3R8wDkScZWzQzMMUm3PWbmWvVJrZwQY4VUNgqFJPMM3No2dFDFGTsxxpG5uJh7n7epu4trkrX7x7DogT5Uv6fcLW5");
|
"xpub6D4BDPcP2GT577Vvch3R8wDkScZWzQzMMUm3PWbmWvVJrZwQY4VUNgqFJPMM3No2dFDFGTsxxpG5uJh7n7epu4trkrX7x7DogT5Uv6fcLW5");
|
||||||
|
|
||||||
// m/0h/1/2h/2
|
// m/0h/1/2h/2
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1/2h/2".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0h/1/2h/2".parse().unwrap(),
|
||||||
"xprvA2JDeKCSNNZky6uBCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334",
|
"xprvA2JDeKCSNNZky6uBCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334",
|
||||||
"xpub6FHa3pjLCk84BayeJxFW2SP4XRrFd1JYnxeLeU8EqN3vDfZmbqBqaGJAyiLjTAwm6ZLRQUMv1ZACTj37sR62cfN7fe5JnJ7dh8zL4fiyLHV");
|
"xpub6FHa3pjLCk84BayeJxFW2SP4XRrFd1JYnxeLeU8EqN3vDfZmbqBqaGJAyiLjTAwm6ZLRQUMv1ZACTj37sR62cfN7fe5JnJ7dh8zL4fiyLHV");
|
||||||
|
|
||||||
// m/0h/1/2h/2/1000000000
|
// m/0h/1/2h/2/1000000000
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0h/1/2h/2/1000000000".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0h/1/2h/2/1000000000".parse().unwrap(),
|
||||||
"xprvA41z7zogVVwxVSgdKUHDy1SKmdb533PjDz7J6N6mV6uS3ze1ai8FHa8kmHScGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76",
|
"xprvA41z7zogVVwxVSgdKUHDy1SKmdb533PjDz7J6N6mV6uS3ze1ai8FHa8kmHScGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76",
|
||||||
"xpub6H1LXWLaKsWFhvm6RVpEL9P4KfRZSW7abD2ttkWP3SSQvnyA8FSVqNTEcYFgJS2UaFcxupHiYkro49S8yGasTvXEYBVPamhGW6cFJodrTHy");
|
"xpub6H1LXWLaKsWFhvm6RVpEL9P4KfRZSW7abD2ttkWP3SSQvnyA8FSVqNTEcYFgJS2UaFcxupHiYkro49S8yGasTvXEYBVPamhGW6cFJodrTHy");
|
||||||
}
|
}
|
||||||
|
@ -1095,32 +1096,32 @@ mod tests {
|
||||||
let seed = hex!("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542");
|
let seed = hex!("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542");
|
||||||
|
|
||||||
// m
|
// m
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "".parse().unwrap(),
|
||||||
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
|
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
|
||||||
"xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB");
|
"xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB");
|
||||||
|
|
||||||
// m/0
|
// m/0
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0".parse().unwrap(),
|
||||||
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt",
|
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt",
|
||||||
"xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH");
|
"xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH");
|
||||||
|
|
||||||
// m/0/2147483647h
|
// m/0/2147483647h
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h".parse().unwrap(),
|
||||||
"xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcEPdU9",
|
"xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcEPdU9",
|
||||||
"xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85ySDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNnBC5y4a");
|
"xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85ySDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNnBC5y4a");
|
||||||
|
|
||||||
// m/0/2147483647h/1
|
// m/0/2147483647h/1
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h/1".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h/1".parse().unwrap(),
|
||||||
"xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25UEPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKADdw4Ef",
|
"xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25UEPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKADdw4Ef",
|
||||||
"xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvmdMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2dhHKon");
|
"xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvmdMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2dhHKon");
|
||||||
|
|
||||||
// m/0/2147483647h/1/2147483646h
|
// m/0/2147483647h/1/2147483646h
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h/1/2147483646h".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h/1/2147483646h".parse().unwrap(),
|
||||||
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc",
|
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc",
|
||||||
"xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL");
|
"xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL");
|
||||||
|
|
||||||
// m/0/2147483647h/1/2147483646h/2
|
// m/0/2147483647h/1/2147483646h/2
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0/2147483647h/1/2147483646h/2".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0/2147483647h/1/2147483646h/2".parse().unwrap(),
|
||||||
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
|
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
|
||||||
"xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt");
|
"xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt");
|
||||||
}
|
}
|
||||||
|
@ -1131,12 +1132,12 @@ mod tests {
|
||||||
let seed = hex!("4b381541583be4423346c643850da4b320e46a87ae3d2a4e6da11eba819cd4acba45d239319ac14f863b8d5ab5a0d0c64d2e8a1e7d1457df2e5a3c51c73235be");
|
let seed = hex!("4b381541583be4423346c643850da4b320e46a87ae3d2a4e6da11eba819cd4acba45d239319ac14f863b8d5ab5a0d0c64d2e8a1e7d1457df2e5a3c51c73235be");
|
||||||
|
|
||||||
// m
|
// m
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "".parse().unwrap(),
|
||||||
"xprv9s21ZrQH143K25QhxbucbDDuQ4naNntJRi4KUfWT7xo4EKsHt2QJDu7KXp1A3u7Bi1j8ph3EGsZ9Xvz9dGuVrtHHs7pXeTzjuxBrCmmhgC6",
|
"xprv9s21ZrQH143K25QhxbucbDDuQ4naNntJRi4KUfWT7xo4EKsHt2QJDu7KXp1A3u7Bi1j8ph3EGsZ9Xvz9dGuVrtHHs7pXeTzjuxBrCmmhgC6",
|
||||||
"xpub661MyMwAqRbcEZVB4dScxMAdx6d4nFc9nvyvH3v4gJL378CSRZiYmhRoP7mBy6gSPSCYk6SzXPTf3ND1cZAceL7SfJ1Z3GC8vBgp2epUt13");
|
"xpub661MyMwAqRbcEZVB4dScxMAdx6d4nFc9nvyvH3v4gJL378CSRZiYmhRoP7mBy6gSPSCYk6SzXPTf3ND1cZAceL7SfJ1Z3GC8vBgp2epUt13");
|
||||||
|
|
||||||
// m/0h
|
// m/0h
|
||||||
test_path(&secp, NetworkKind::Main, &seed, "m/0h".parse().unwrap(),
|
test_path(&secp, NetworkKind::Main, &seed, "0h".parse().unwrap(),
|
||||||
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
|
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
|
||||||
"xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y");
|
"xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: CC0-1.0
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
use io::{Cursor, BufRead, Read};
|
use io::{BufRead, Cursor, Read};
|
||||||
|
|
||||||
use crate::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpub};
|
use crate::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpub};
|
||||||
use crate::blockdata::transaction::Transaction;
|
use crate::blockdata::transaction::Transaction;
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ mod tests {
|
||||||
vec![(raw::Key { type_value: 1, key: vec![0, 1] }, vec![3, 4, 5])]
|
vec![(raw::Key { type_value: 1, key: vec![0, 1] }, vec![3, 4, 5])]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect();
|
.collect();
|
||||||
let key_source = ("deadbeef".parse().unwrap(), "m/0'/1".parse().unwrap());
|
let key_source = ("deadbeef".parse().unwrap(), "0'/1".parse().unwrap());
|
||||||
let keypaths: BTreeMap<secp256k1::PublicKey, KeySource> = vec![(
|
let keypaths: BTreeMap<secp256k1::PublicKey, KeySource> = vec![(
|
||||||
"0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(),
|
"0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(),
|
||||||
key_source.clone(),
|
key_source.clone(),
|
||||||
|
|
Binary file not shown.
|
@ -63,8 +63,8 @@ fn bip174_psbt_workflow() {
|
||||||
|
|
||||||
// Strings from BIP 174 test vector.
|
// Strings from BIP 174 test vector.
|
||||||
let test_vector = vec![
|
let test_vector = vec![
|
||||||
("cP53pDbR5WtAD8dYAW9hhTjuvvTVaEiQBdrz9XPrgLBeRFiyCbQr", "m/0h/0h/0h"), // from_priv, into_derivation_path?
|
("cP53pDbR5WtAD8dYAW9hhTjuvvTVaEiQBdrz9XPrgLBeRFiyCbQr", "0h/0h/0h"), // from_priv, into_derivation_path?
|
||||||
("cR6SXDoyfQrcp4piaiHE97Rsgta9mNhGTen9XeonVgwsh4iSgw6d", "m/0h/0h/2h"),
|
("cR6SXDoyfQrcp4piaiHE97Rsgta9mNhGTen9XeonVgwsh4iSgw6d", "0h/0h/2h"),
|
||||||
];
|
];
|
||||||
|
|
||||||
// We pass the keys to the signer after doing verification to make explicit
|
// We pass the keys to the signer after doing verification to make explicit
|
||||||
|
@ -78,8 +78,8 @@ fn bip174_psbt_workflow() {
|
||||||
|
|
||||||
// Strings from BIP 174 test vector.
|
// Strings from BIP 174 test vector.
|
||||||
let test_vector = vec![
|
let test_vector = vec![
|
||||||
("cT7J9YpCwY3AVRFSjN6ukeEeWY6mhpbJPxRaDaP5QTdygQRxP9Au", "m/0h/0h/1h"),
|
("cT7J9YpCwY3AVRFSjN6ukeEeWY6mhpbJPxRaDaP5QTdygQRxP9Au", "0h/0h/1h"),
|
||||||
("cNBc3SWUip9PPm1GjRoLEJT6T41iNzCYtD7qro84FMnM5zEqeJsE", "m/0h/0h/3h"),
|
("cNBc3SWUip9PPm1GjRoLEJT6T41iNzCYtD7qro84FMnM5zEqeJsE", "0h/0h/3h"),
|
||||||
];
|
];
|
||||||
|
|
||||||
let keys = parse_and_verify_keys(&ext_priv, &test_vector);
|
let keys = parse_and_verify_keys(&ext_priv, &test_vector);
|
||||||
|
@ -222,12 +222,12 @@ fn update_psbt(mut psbt: Psbt, fingerprint: Fingerprint) -> Psbt {
|
||||||
// Public key and its derivation path (these are the child pubkeys for our `Xpriv`,
|
// Public key and its derivation path (these are the child pubkeys for our `Xpriv`,
|
||||||
// can be verified by deriving the key using this derivation path).
|
// can be verified by deriving the key using this derivation path).
|
||||||
let pk_path = vec![
|
let pk_path = vec![
|
||||||
("029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f", "m/0h/0h/0h"),
|
("029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f", "0h/0h/0h"),
|
||||||
("02dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d7", "m/0h/0h/1h"),
|
("02dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d7", "0h/0h/1h"),
|
||||||
("03089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc", "m/0h/0h/2h"),
|
("03089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc", "0h/0h/2h"),
|
||||||
("023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e73", "m/0h/0h/3h"),
|
("023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e73", "0h/0h/3h"),
|
||||||
("03a9a4c37f5996d3aa25dbac6b570af0650394492942460b354753ed9eeca58771", "m/0h/0h/4h"),
|
("03a9a4c37f5996d3aa25dbac6b570af0650394492942460b354753ed9eeca58771", "0h/0h/4h"),
|
||||||
("027f6399757d2eff55a136ad02c684b1838b6556e5f1b6b34282a94b6b50051096", "m/0h/0h/5h"),
|
("027f6399757d2eff55a136ad02c684b1838b6556e5f1b6b34282a94b6b50051096", "0h/0h/5h"),
|
||||||
];
|
];
|
||||||
|
|
||||||
let expected_psbt_hex = include_str!("data/update_1_psbt_hex");
|
let expected_psbt_hex = include_str!("data/update_1_psbt_hex");
|
||||||
|
|
|
@ -246,7 +246,7 @@ fn serde_regression_psbt() {
|
||||||
};
|
};
|
||||||
let unknown: BTreeMap<raw::Key, Vec<u8>> =
|
let unknown: BTreeMap<raw::Key, Vec<u8>> =
|
||||||
vec![(raw::Key { type_value: 9, key: vec![0, 1] }, vec![3, 4, 5])].into_iter().collect();
|
vec![(raw::Key { type_value: 9, key: vec![0, 1] }, vec![3, 4, 5])].into_iter().collect();
|
||||||
let key_source = ("deadbeef".parse().unwrap(), "m/0'/1".parse().unwrap());
|
let key_source = ("deadbeef".parse().unwrap(), "0'/1".parse().unwrap());
|
||||||
let keypaths: BTreeMap<secp256k1::PublicKey, KeySource> = vec![(
|
let keypaths: BTreeMap<secp256k1::PublicKey, KeySource> = vec![(
|
||||||
"0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(),
|
"0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(),
|
||||||
key_source.clone(),
|
key_source.clone(),
|
||||||
|
|
Loading…
Reference in New Issue