mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
refactor: Avoid duplicate map lookup in ScriptToAsmStr
This commit is contained in:
parent
e796fdd4cb
commit
ac2ff4fb1e
1 changed files with 3 additions and 2 deletions
|
@ -111,8 +111,9 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
|
|||
// checks in CheckSignatureEncoding.
|
||||
if (CheckSignatureEncoding(vch, SCRIPT_VERIFY_STRICTENC, nullptr)) {
|
||||
const unsigned char chSigHashType = vch.back();
|
||||
if (mapSigHashTypes.count(chSigHashType)) {
|
||||
strSigHashDecode = "[" + mapSigHashTypes.find(chSigHashType)->second + "]";
|
||||
const auto it = mapSigHashTypes.find(chSigHashType);
|
||||
if (it != mapSigHashTypes.end()) {
|
||||
strSigHashDecode = "[" + it->second + "]";
|
||||
vch.pop_back(); // remove the sighash type byte. it will be replaced by the decode.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue