mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 23:42:33 +02:00
Merge #19852: refactor: Avoid duplicate map lookup in ScriptToAsmStr
ac2ff4fb1e
refactor: Avoid duplicate map lookup in ScriptToAsmStr (João Barbosa) Pull request description: Simple change that avoids a duplicate (unnecessary) `mapSigHashTypes` lookup. ACKs for top commit: laanwj: re-ACKac2ff4fb1e
Tree-SHA512: 7e7f5af51c1acd7a42af273e5ee5e2faddd250ba8b8f63ccb3172d95f153ae391b2816b79564b856571af52dc2a767b5736a5d10ffb5cd2c540cd9832bf86419
This commit is contained in:
commit
81a19e7253
@ -111,8 +111,9 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
|
|||||||
// checks in CheckSignatureEncoding.
|
// checks in CheckSignatureEncoding.
|
||||||
if (CheckSignatureEncoding(vch, SCRIPT_VERIFY_STRICTENC, nullptr)) {
|
if (CheckSignatureEncoding(vch, SCRIPT_VERIFY_STRICTENC, nullptr)) {
|
||||||
const unsigned char chSigHashType = vch.back();
|
const unsigned char chSigHashType = vch.back();
|
||||||
if (mapSigHashTypes.count(chSigHashType)) {
|
const auto it = mapSigHashTypes.find(chSigHashType);
|
||||||
strSigHashDecode = "[" + mapSigHashTypes.find(chSigHashType)->second + "]";
|
if (it != mapSigHashTypes.end()) {
|
||||||
|
strSigHashDecode = "[" + it->second + "]";
|
||||||
vch.pop_back(); // remove the sighash type byte. it will be replaced by the decode.
|
vch.pop_back(); // remove the sighash type byte. it will be replaced by the decode.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user