]>
Commit | Line | Data |
---|---|---|
da03e6ed | 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto |
2 | // Copyright (c) 2009-2013 The Bitcoin developers | |
3 | // Distributed under the MIT/X11 software license, see the accompanying | |
4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
5 | ||
6 | #ifndef H_BITCOIN_SCRIPT_INTERPRETER | |
7 | #define H_BITCOIN_SCRIPT_INTERPRETER | |
8 | ||
9 | #include <vector> | |
10 | #include <stdint.h> | |
11 | #include <string> | |
12 | ||
13 | class uint256; | |
14 | class CScript; | |
15 | class CTransaction; | |
16 | ||
17 | /** Signature hash types/flags */ | |
18 | enum | |
19 | { | |
20 | SIGHASH_ALL = 1, | |
21 | SIGHASH_NONE = 2, | |
22 | SIGHASH_SINGLE = 3, | |
23 | SIGHASH_ANYONECANPAY = 0x80, | |
24 | }; | |
25 | ||
26 | /** Script verification flags */ | |
27 | enum | |
28 | { | |
29 | SCRIPT_VERIFY_NONE = 0, | |
30 | SCRIPT_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts | |
31 | SCRIPT_VERIFY_STRICTENC = (1U << 1), // enforce strict conformance to DER and SEC2 for signatures and pubkeys | |
32 | SCRIPT_VERIFY_LOW_S = (1U << 2), // enforce low S values (<n/2) in signatures (depends on STRICTENC) | |
33 | SCRIPT_VERIFY_NOCACHE = (1U << 3), // do not store results in signature cache (but do query it) | |
34 | SCRIPT_VERIFY_NULLDUMMY = (1U << 4), // verify dummy stack item consumed by CHECKMULTISIG is of zero-length | |
35 | }; | |
36 | ||
37 | bool IsCanonicalPubKey(const std::vector<unsigned char> &vchPubKey, unsigned int flags); | |
38 | bool IsCanonicalSignature(const std::vector<unsigned char> &vchSig, unsigned int flags); | |
39 | ||
40 | uint256 SignatureHash(const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType); | |
41 | bool CheckSig(std::vector<unsigned char> vchSig, const std::vector<unsigned char> &vchPubKey, const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType, int flags); | |
42 | bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType); | |
43 | bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType); | |
44 | ||
45 | #endif |