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
test: extend unit tests to cover KeyMapWrapper error conditions
Claude 4 wrote the original tests; I then replaced its fix (which incorrectly
also propagated errors in GetKey for KeyMap), updated the tests, and removed
some extra tests which seemed uninformative and just noisy.
To backport this to 12.x, just do s/KeyMap/KeyMapWrapper/ on the new tests.
Oh, and add some `let keymap = KeyMapWrapper::from(keymap)` lines.
Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>
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 commit comments