Skip to content

Commit 91a42d6

Browse files
committed
Merge bitcoin#25019: parse external signer master fp as bytes in ExternalSigner::SignTransaction
2a22f03 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 2a22f03 theStack: Code-review ACK 2a22f03 Sjors: utACK 2a22f03 Tree-SHA512: f3d84b83fb0b5e06c405eaf9bf20a2fa864bf4172fd4de113b80b9b9a525a76f2f8cf63031b480358b3a7666023a2aef131fb89ff50448c66df3ed541da10f99
2 parents 98f4db3 + 2a22f03 commit 91a42d6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/external_signer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str
7474
// Serialize the PSBT
7575
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
7676
ssTx << psbtx;
77-
77+
// parse ExternalSigner master fingerprint
78+
std::vector<unsigned char> parsed_m_fingerprint = ParseHex(m_fingerprint);
7879
// Check if signer fingerprint matches any input master key fingerprint
7980
auto matches_signer_fingerprint = [&](const PSBTInput& input) {
8081
for (const auto& entry : input.hd_keypaths) {
81-
if (m_fingerprint == strprintf("%08x", ReadBE32(entry.second.fingerprint))) return true;
82+
if (parsed_m_fingerprint == MakeUCharSpan(entry.second.fingerprint)) return true;
8283
}
8384
return false;
8485
};

0 commit comments

Comments
 (0)