aboutsummaryrefslogtreecommitdiff
path: root/src/core_write.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core_write.cpp')
-rw-r--r--src/core_write.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core_write.cpp b/src/core_write.cpp
index f9d918cb6d..3980d8cb2e 100644
--- a/src/core_write.cpp
+++ b/src/core_write.cpp
@@ -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.
}
}