You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #861: key_map.rs: propagate "invalid key" errors from multipath keys
89b5048 test: extend unit tests to cover KeyMapWrapper error conditions (Andrew Poelstra)
78cddab key_map: handle lookup errors on multipath xprivs correctly (Andrew Poelstra)
Pull request description:
Since #851 we return a `NotSupported` error when attempting to request an xpriv from an x-only key. I'm not sure if this is the correct semantics, but it was deliberately written, so we'll keep it. **However** the behavior was different for multipath xprivs. There we returned `None`, i.e. "key not found/mismatch" rather than an error.
This PR returns an error in both cases.
ACKs for top commit:
oleonardolima:
ACK 89b5048
Tree-SHA512: e59b4d6877374c7e07ddf282422c42b6735f04514d2cc70610dca15dd4153cd372f9a1ccf86d3ce57ea32e8784229de0288a0e1b196405034065d92e5b134f9c
let descriptor_sk = DescriptorSecretKey::from_str("xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi").unwrap();
let descriptor_sk = DescriptorSecretKey::from_str("[d34db33f/84h/0h/0h]tprv8ZgxMBicQKsPd3EupYiPRhaMooHKUHJxNsTfYuScep13go8QFfHdtkG9nRkFGb7busX4isf6X9dURGCoKgitaApQ6MupRhZMcELAxTBRJgS/<0;1>").unwrap();
389
+
390
+
// Request with a different fingerprint
391
+
let different_fingerprint = bitcoin::bip32::Fingerprint::from([0x12,0x34,0x56,0x78]);
392
+
let path = DerivationPath::from_str("84'/1'/0'/0").unwrap();
393
+
let request = KeyRequest::Bip32((different_fingerprint, path));
394
+
395
+
let result = descriptor_sk.get_key(request.clone(),&secp).unwrap();
396
+
assert!(result.is_none(),"Should return None when fingerprint doesn't match");
397
+
398
+
// Create an x-only public key request -- now we get "not supported".
// Also test with KeyMap; as in the previous test, the error turns to None.
408
+
let descriptor_s = "wpkh([d34db33f/84h/1h/0h]tprv8ZgxMBicQKsPd3EupYiPRhaMooHKUHJxNsTfYuScep13go8QFfHdtkG9nRkFGb7busX4isf6X9dURGCoKgitaApQ6MupRhZMcELAxTBRJgS/<0;1>/*)";
0 commit comments