diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-09-10 16:16:09 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2014-10-02 20:26:17 +0200 |
commit | 5c1e798a8e9df15f8fbd120e57fc67e585f13843 (patch) | |
tree | 2b9cd1acc9565a7946683b50b237c332484de5e4 /src/script/sigcache.h | |
parent | c7829ea797c840dda7888ee860a50b7a3308069d (diff) |
Make signature cache optional
Diffstat (limited to 'src/script/sigcache.h')
-rw-r--r-- | src/script/sigcache.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/script/sigcache.h b/src/script/sigcache.h new file mode 100644 index 0000000000..8faa7ae01f --- /dev/null +++ b/src/script/sigcache.h @@ -0,0 +1,34 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2013 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef H_BITCOIN_SCRIPT_SIGCACHE +#define H_BITCOIN_SCRIPT_SIGCACHE + +#include "script/interpreter.h" + +#include <vector> + +class CPubKey; + +class CachingSignatureChecker : public SignatureChecker +{ +public: + CachingSignatureChecker(const CTransaction& txToIn, unsigned int nInIn) : SignatureChecker(txToIn, nInIn) {} + + bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash, int flags) const; +}; + +// Wrappers using a default SignatureChecker. +bool inline EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags) +{ + return EvalScript(stack, script, flags, CachingSignatureChecker(txTo, nIn)); +} + +bool inline VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, unsigned int flags) +{ + return VerifyScript(scriptSig, scriptPubKey, flags, CachingSignatureChecker(txTo, nIn)); +} + +#endif |