diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-12-01 22:30:06 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2013-01-08 01:49:15 +0100 |
commit | 2800ce7367760a9bb8fd5209feddf71e574a592d (patch) | |
tree | 03a3551000b10db481b48a87a041f7b266729358 /src/main.h | |
parent | f1136200a67fc1df894d45fba51b40f748e0b889 (diff) |
Add CScriptCheck: a closure representing a script check
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/main.h b/src/main.h index a098cc775c..83454e331b 100644 --- a/src/main.h +++ b/src/main.h @@ -430,7 +430,6 @@ enum GetMinFee_mode GMF_SEND, }; -// Modes for script/signature checking enum CheckSig_mode { CS_NEVER, // never validate scripts @@ -1015,7 +1014,33 @@ public: } }; +/** Closure representing one script verification + * Note that this stores references to the spending transaction */ +class CScriptCheck +{ +private: + CScript scriptPubKey; + const CTransaction *ptxTo; + unsigned int nIn; + unsigned int nFlags; + int nHashType; + +public: + CScriptCheck() {} + CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, int nHashTypeIn) : + scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), + ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), nHashType(nHashTypeIn) { } + + bool operator()() const; + void swap(CScriptCheck &check) { + scriptPubKey.swap(check.scriptPubKey); + std::swap(ptxTo, check.ptxTo); + std::swap(nIn, check.nIn); + std::swap(nFlags, check.nFlags); + std::swap(nHashType, check.nHashType); + } +}; /** A transaction with a merkle branch linking it to the block chain. */ class CMerkleTx : public CTransaction |