What changed, and why it matters
This commit only changes test code. It updates a unit test so that it checks both single-signature and multi-signature PSBT inputs, and it makes the fingerprint assertions more precise by distinguishing public keys that belong to the current seed from those that don't. There is no change to the actual application code that handles seeds or transactions.
No security action needed; treat as a routine test maintenance commit. If reviewing the broader PR, confirm that the production PSBT parser behavior already matches what the updated test now asserts.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_psbt_parser.py. It swaps PSBTTestData.SINGLE_SIG_INPUTS for PSBTTestData.ALL_INPUTS in a test that simulates XPUB-only imports with missing fingerprints. It then refines assertions: instead of requiring every BIP32 and Taproot derivation fingerprint to equal the seed fingerprint, it now derives each public key from parser.root, compares its SEC serialization to the PSBT public key, and only asserts the seed fingerprint when the key actually derives from the current seed; otherwise it expects the placeholder 00000000. This is a test-only fix that aligns expectations with multi-signature PSBTs where not all keys belong to the signing seed.
Changed components
tests/test_psbt_parser.pyInspect captured patch +21 / −5
diff --git a/tests/test_psbt_parser.py b/tests/test_psbt_parser.py
index a24c1f5..a3c1ab9 100644
--- a/tests/test_psbt_parser.py
+++ b/tests/test_psbt_parser.py
@@ -154,7 +154,7 @@ class TestPSBTParser:
PSBTParser should correctly handle PSBTs with missing fingerprints (created from XPUB-only imports,
without derivation path) by matching public keys against the seed and filling in correct fingerprints.
"""
- for input in PSBTTestData.SINGLE_SIG_INPUTS:
+ for input in PSBTTestData.ALL_INPUTS:
psbt = PSBT.parse(a2b_base64(input))
# Set fingerprints to zero to simulate XPUB-only import (missing fingerprint)
@@ -189,15 +189,31 @@ class TestPSBTParser:
for inp in parser.psbt.inputs:
for pub, derivation in inp.bip32_derivations.items():
- # Must match the signing seed's fingerprint
from binascii import hexlify
- assert hexlify(derivation.fingerprint).decode() == seed_fingerprint
+ fingerprint_hex = hexlify(derivation.fingerprint).decode()
+
+ # Check if this public key derives from the current seed
+ derived_key = parser.root.derive(derivation.derivation)
+ if derived_key.key.sec() == pub.sec():
+ # This pubkey derives from current seed, should have current seed's fingerprint
+ assert fingerprint_hex == seed_fingerprint, f"Expected {seed_fingerprint}, got {fingerprint_hex} for pubkey that derives from current seed"
+ else:
+ # This pubkey doesn't derive from current seed, should remain 00000000
+ assert fingerprint_hex == "00000000"
# Also check Taproot derivations
for pub, (leaf_hashes, derivation) in inp.taproot_bip32_derivations.items():
- # Must match the signing seed's fingerprint
from binascii import hexlify
- assert hexlify(derivation.fingerprint).decode() == seed_fingerprint
+ fingerprint_hex = hexlify(derivation.fingerprint).decode()
+
+ # Check if this public key derives from the current seed
+ derived_key = parser.root.derive(derivation.derivation)
+ if derived_key.key.sec() == pub.sec():
+ # This pubkey derives from current seed, should have current seed's fingerprint
+ assert fingerprint_hex == seed_fingerprint, f"Expected {seed_fingerprint}, got {fingerprint_hex} for taproot pubkey that derives from current seed"
+ else:
+ # This pubkey doesn't derive from current seed, should remain 00000000
+ assert fingerprint_hex == "00000000"
def test_trim_and_sig_count(self):
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.