Fix master_fingerprint for no-origin raw keys - #1023
Conversation
|
Wow. This is some old code. Dates to #219 (by me) which was approved and merged with no comments. I'm not sure what I was thinking. Later in #265 we fixed the doccomment but were distracted by a bug in the other branch of the function and didn't look at this. CI is failing because this breaks one of the examples. |
The example signed via BIP32 keysource lookup on xprvs. Since master_fingerprint now returns the all-zero fingerprint for raw no-origin keys, the BIP32 match can no longer succeed. Sign by pubkey instead, which the PSBT signer's pubkey/xonly fallback handles natively.
|
@apoelstra Appreciate the pointer , and the history . You're right that this dates back to #219 (by you) and the doc was corrected in #265, but the implementation branch was left untouched, so the two were inconsistent ever since. I fixed the example to sign by public key (a |
|
Lol wtf you can't even sign for an xpub using an xprv anymore? I will file an issue about the weird fingerprint computation. Meanwhile please stop contributing to this organization. |
DescriptorPublicKey::master_fingerprintis documented to return0x00000000when a key has no origin, but for raw (Single) keys with no origin it instead returned a synthetic fingerprint derived from the key bytes. That fabricated value then leaked into PSBT bip32_derivation / tap_key_origins as an invented (fingerprint, empty_path) origin.This makes master_fingerprint return the all-zero fingerprint for no-origin raw keys, matching the documented contract. xpub keys are unchanged (their no-origin fingerprint is the real xpub fingerprint).
plan.rskeyed signing assets by (fingerprint, path), which now collides for distinct raw keys; added araw_keysset keyed by the key itself for no-origin raw keys.Fixes #998.