diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-05-16 15:49:54 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-05-16 15:57:07 -0400 |
commit | 91a42d63efaff9a7eb955802b6d9f2c768d65db0 (patch) | |
tree | 98a8c4958a9b1d0e72c30664c5e9042d3a158db7 /src | |
parent | 98f4db33056be03a410e852e0ca9397734b0f56d (diff) | |
parent | 2a22f034ca3298c9f86d1edd4283a0bea18dfbbe (diff) |
Merge bitcoin/bitcoin#25019: parse external signer master fp as bytes in ExternalSigner::SignTransaction
2a22f034ca3298c9f86d1edd4283a0bea18dfbbe parsing external signer master fingerprint string as bytes instead of caring for lower/upper case in ExternalSigner::SignTransaction (avirgovi)
Pull request description:
Some external signers scripts may provide master fingerprint in uppercase format. In that case core will fail with `Signer fingerprint 00000000 does not match any of the inputs` as it only works with lowercase format. Even if the fingerprints match, yet one is lowercase the other uppercase.
ExternalSigner::SignTransaction is the only place where it is needed IMO, as changing it in other places may break the communication with the external signer (i.e. enumerating with lowercase may not find the device).
ACKs for top commit:
achow101:
ACK 2a22f034ca3298c9f86d1edd4283a0bea18dfbbe
theStack:
Code-review ACK 2a22f034ca3298c9f86d1edd4283a0bea18dfbbe
Sjors:
utACK 2a22f034ca3298c9f86d1edd4283a0bea18dfbbe
Tree-SHA512: f3d84b83fb0b5e06c405eaf9bf20a2fa864bf4172fd4de113b80b9b9a525a76f2f8cf63031b480358b3a7666023a2aef131fb89ff50448c66df3ed541da10f99
Diffstat (limited to 'src')
-rw-r--r-- | src/external_signer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/external_signer.cpp b/src/external_signer.cpp index 75070899c6..d125fe479b 100644 --- a/src/external_signer.cpp +++ b/src/external_signer.cpp @@ -74,11 +74,12 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str // Serialize the PSBT CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << psbtx; - + // parse ExternalSigner master fingerprint + std::vector<unsigned char> parsed_m_fingerprint = ParseHex(m_fingerprint); // Check if signer fingerprint matches any input master key fingerprint auto matches_signer_fingerprint = [&](const PSBTInput& input) { for (const auto& entry : input.hd_keypaths) { - if (m_fingerprint == strprintf("%08x", ReadBE32(entry.second.fingerprint))) return true; + if (parsed_m_fingerprint == MakeUCharSpan(entry.second.fingerprint)) return true; } return false; }; |