From b47fa91d6c9c0db98c03d45a7944f16448c6bdc6 Mon Sep 17 00:00:00 2001 From: Krystie Date: Sun, 10 May 2026 01:38:42 -0700 Subject: [PATCH] Fix script signature const-correctness regression --- src/script.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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);