aboutsummaryrefslogtreecommitdiff
path: root/src/script/interpreter.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-10-12 18:39:47 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2014-11-25 12:38:01 +0100
commitb6e03cc59208305681745ad06f2056ffe6690597 (patch)
tree78e701bf890c2302c2249266cfcd124e5b7e554a /src/script/interpreter.h
parentae4151bbad74ab54de818d7704fa4568ee65e40d (diff)
downloadbitcoin-b6e03cc59208305681745ad06f2056ffe6690597.tar.xz
Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6)
Based on an earlier patch by Peter Todd, though the rules here are different (P2SH scripts should not have a CLEANSTACK check before the P2SH evaluation).
Diffstat (limited to 'src/script/interpreter.h')
-rw-r--r--src/script/interpreter.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/script/interpreter.h b/src/script/interpreter.h
index 35b2f6c65a..9b35b176ae 100644
--- a/src/script/interpreter.h
+++ b/src/script/interpreter.h
@@ -67,8 +67,14 @@ enum
// discouraged NOPs fails the script. This verification flag will never be
// a mandatory flag applied to scripts in a block. NOPs that are not
// executed, e.g. within an unexecuted IF ENDIF block, are *not* rejected.
- SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1U << 7)
-
+ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1U << 7),
+
+ // Require that only a single stack element remains after evaluation. This changes the success criterion from
+ // "At least one stack element must remain, and when interpreted as a boolean, it must be true" to
+ // "Exactly one stack element must remain, and when interpreted as a boolean, it must be true".
+ // (softfork safe, BIP62 rule 6)
+ // Note: CLEANSTACK should never be used without P2SH.
+ SCRIPT_VERIFY_CLEANSTACK = (1U << 8),
};
uint256 SignatureHash(const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);