aboutsummaryrefslogtreecommitdiff
path: root/src/script/interpreter.cpp
diff options
context:
space:
mode:
authorPeter Todd <pete@petertodd.org>2014-11-10 02:33:19 -0500
committerPieter Wuille <pieter.wuille@gmail.com>2014-11-20 15:29:28 +0100
commitca8158719b17ebdcf1de1e26079b6b896122d0e5 (patch)
tree581c5ca00b34e78318b434c9a995e44c73850c01 /src/script/interpreter.cpp
parent98b135f97f16005687f420136114f80555bc8688 (diff)
Test the exact order of CHECKMULTISIG sig/pubkey evaluation
Possible with STRICTENC
Diffstat (limited to 'src/script/interpreter.cpp')
-rw-r--r--src/script/interpreter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index a2a2edce6d..5eda23731d 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -855,6 +855,9 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
valtype& vchSig = stacktop(-isig);
valtype& vchPubKey = stacktop(-ikey);
+ // Note how this makes the exact order of pubkey/signature evaluation
+ // distinguishable by CHECKMULTISIG NOT if the STRICTENC flag is set.
+ // See the script_(in)valid tests for details.
if (!CheckSignatureEncoding(vchSig, flags, serror) || !CheckPubKeyEncoding(vchPubKey, flags, serror)) {
// serror is set
return false;
@@ -871,7 +874,8 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
nKeysCount--;
// If there are more signatures left than keys left,
- // then too many signatures have failed
+ // then too many signatures have failed. Exit early,
+ // without checking any further signatures.
if (nSigsCount > nKeysCount)
fSuccess = false;
}