diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-13 23:03:25 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-15 23:00:16 +0100 |
commit | 99d0d0f356c3237ad1ef416f179c45797cecb89b (patch) | |
tree | 72c34c5fe86b95be861f02fdfe5e497f24b56117 /src/script.h | |
parent | 6caffb5358b1e403b293846b3c832433fa928e46 (diff) |
Introduce script verification flags
These flags select features to be enabled/disabled during script
evaluation/checking, instead of several booleans passed along.
Currently these flags are defined:
* SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
* SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
Diffstat (limited to 'src/script.h')
-rw-r--r-- | src/script.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/script.h b/src/script.h index f9df587ca3..7b0643f70a 100644 --- a/src/script.h +++ b/src/script.h @@ -26,6 +26,13 @@ enum SIGHASH_ANYONECANPAY = 0x80, }; +/** Script verification flags */ +enum +{ + SCRIPT_VERIFY_NONE = 0, + SCRIPT_VERIFY_P2SH = (1U << 0), + SCRIPT_VERIFY_STRICTENC = (1U << 1), +}; enum txnouttype { @@ -656,7 +663,7 @@ public: bool IsCanonicalPubKey(const std::vector<unsigned char> &vchPubKey); bool IsCanonicalSignature(const std::vector<unsigned char> &vchSig); -bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, bool fStrictEncodings, int nHashType); +bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType); bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet); int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned char> >& vSolutions); bool IsStandard(const CScript& scriptPubKey); @@ -667,8 +674,8 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std:: bool SignSignature(const CKeyStore& keystore, const CScript& fromPubKey, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, - bool fValidatePayToScriptHash, bool fStrictEncodings, int nHashType); -bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, bool fValidatePayToScriptHash, bool fStrictEncodings, int nHashType); + unsigned int flags, int nHashType); +bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType); // Given two sets of signatures for scriptPubKey, possibly with OP_0 placeholders, // combine them intelligently and return the result. |