aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-11-21 13:58:10 -0500
committerGavin Andresen <gavinandresen@gmail.com>2012-11-21 13:58:10 -0500
commita91efb2d8d2791f324705e24909af51640ca73e4 (patch)
tree2dd90dcc41c3d617f68e3da3c5568cc50faef3b3 /src/script.cpp
parent4725e96a3aaa4dd602bd356390d190c6777c3a60 (diff)
Add assert and comment for subtle pay-to-script-hash logic
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script.cpp b/src/script.cpp
index a40ae5b1db..f65508aacc 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -1658,6 +1658,11 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C
if (!scriptSig.IsPushOnly()) // scriptSig must be literals-only
return false; // or validation fails
+ // stackCopy cannot be empty here, because if it was the
+ // P2SH HASH <> EQUAL scriptPubKey would be evaluated with
+ // an empty stack and the EvalScript above would return false.
+ assert(!stackCopy.empty());
+
const valtype& pubKeySerialized = stackCopy.back();
CScript pubKey2(pubKeySerialized.begin(), pubKeySerialized.end());
popstack(stackCopy);