Use separate SignatureChecker for CMutableTransaction
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#define BITCOIN_SCRIPT_INTERPRETER_H
|
||||
|
||||
#include "script_error.h"
|
||||
#include "primitives/transaction.h"
|
||||
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
@@ -90,7 +91,7 @@ public:
|
||||
virtual ~BaseSignatureChecker() {}
|
||||
};
|
||||
|
||||
class SignatureChecker : public BaseSignatureChecker
|
||||
class TransactionSignatureChecker : public BaseSignatureChecker
|
||||
{
|
||||
private:
|
||||
const CTransaction& txTo;
|
||||
@@ -100,10 +101,19 @@ protected:
|
||||
virtual bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const;
|
||||
|
||||
public:
|
||||
SignatureChecker(const CTransaction& txToIn, unsigned int nInIn) : txTo(txToIn), nIn(nInIn) {}
|
||||
TransactionSignatureChecker(const CTransaction& txToIn, unsigned int nInIn) : txTo(txToIn), nIn(nInIn) {}
|
||||
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const;
|
||||
};
|
||||
|
||||
class MutableTransactionSignatureChecker : public TransactionSignatureChecker
|
||||
{
|
||||
private:
|
||||
const CTransaction txTo;
|
||||
|
||||
public:
|
||||
MutableTransactionSignatureChecker(const CMutableTransaction& txToIn, unsigned int nInIn) : TransactionSignatureChecker(txTo, nInIn), txTo(txToIn) {}
|
||||
};
|
||||
|
||||
bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* error = NULL);
|
||||
bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* error = NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user