diff --git a/src/script.cpp b/src/script.cpp index 802f8e1..42f7c79 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1283,18 +1283,20 @@ bool CheckSig(const vector& vchSig, const vector& nHashType = vchSig.back(); else if (nHashType != vchSig.back()) return false; - vchSig.pop_back(); + + vector vchSigCopy(vchSig); + vchSigCopy.pop_back(); uint256 sighash = SignatureHash(scriptCode, txTo, nIn, nHashType); - if (signatureCache.Get(sighash, vchSig, vchPubKey)) + if (signatureCache.Get(sighash, vchSigCopy, vchPubKey)) return true; CKey key; if (!key.SetPubKey(vchPubKey)) return false; - if (!key.Verify(sighash, vchSig)) + if (!key.Verify(sighash, vchSigCopy)) return false; signatureCache.Set(sighash, vchSig, vchPubKey);