7#ifndef BITCOIN_SCRIPT_INTERPRETER_H
8#define BITCOIN_SCRIPT_INTERPRETER_H
27bool CastToBool(
const std::vector<uint8_t> &vch);
80 virtual bool CheckSig(
const std::vector<uint8_t> &vchSigIn,
81 const std::vector<uint8_t> &vchPubKey,
111 const T *txToIn,
unsigned int nInIn,
const Amount &amountIn,
116 bool CheckSig(
const std::vector<uint8_t> &vchSigIn,
117 const std::vector<uint8_t> &vchPubKey,
119 uint32_t
flags)
const final override;
132 std::vector<std::vector<uint8_t>> &
stack;
216static inline bool EvalScript(std::vector<std::vector<uint8_t>> &stack,
virtual bool VerifySignature(const std::vector< uint8_t > &vchSig, const CPubKey &vchPubKey, const uint256 &sighash) const
virtual bool CheckLockTime(const CScriptNum &nLockTime) const
virtual bool CheckSequence(const CScriptNum &nSequence) const
virtual bool CheckSig(const std::vector< uint8_t > &vchSigIn, const std::vector< uint8_t > &vchPubKey, const CScript &scriptCode, uint32_t flags) const
virtual ~BaseSignatureChecker()
An encapsulated public key.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
A data type to abstract out the condition stack during script execution.
bool CheckSig(const std::vector< uint8_t > &vchSigIn, const std::vector< uint8_t > &vchPubKey, const CScript &scriptCode, uint32_t flags) const final override
const PrecomputedTransactionData * txdata
bool CheckSequence(const CScriptNum &nSequence) const final override
GenericTransactionSignatureChecker(const T *txToIn, unsigned int nInIn, const Amount &amountIn)
SigHashCache m_sighash_cache
GenericTransactionSignatureChecker(const T *txToIn, unsigned int nInIn, const Amount &amountIn, const PrecomputedTransactionData &txdataIn)
bool CheckLockTime(const CScriptNum &nLockTime) const final override
A writer stream (for serialization) that computes a 256-bit hash.
CScript::const_iterator pend
bool CheckPostConditions()
const std::vector< std::vector< uint8_t > > & GetStack() const
const std::vector< std::vector< uint8_t > > & GetAltStack() const
std::vector< std::vector< uint8_t > > altstack
CScript::const_iterator pbegincodehash
ScriptError GetScriptError()
bool RunNextOp() noexcept
const ConditionStack & GetConditionStack()
const BaseSignatureChecker & checker
bool CheckPreConditions()
CScript::const_iterator pc
ScriptInterpreter(std::vector< std::vector< uint8_t > > &stack, const CScript &script, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metrics)
std::vector< std::vector< uint8_t > > & stack
bool GetNextOp(opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
ScriptExecutionMetrics & metrics
Data structure to cache SHA256 midstates for the ECDSA sighash calculations (bare,...
void Store(const SigHashType &hash_type, const CScript &script_code, const HashWriter &writer) noexcept
Store into this cache object the provided SHA256 midstate.
bool Load(const SigHashType &hash_type, const CScript &script_code, HashWriter &writer) const noexcept
Load into writer the SHA256 midstate if found in this cache.
std::optional< std::pair< CScript, HashWriter > > m_cache_entries[12]
For each sighash mode: [0] ALL [1] NONE [2] SINGLE [3] ALL|ANYONE [4] NONE|ANYONE [5] SINGLE|ANYONE [...
int CacheIndex(const SigHashType &hash_type) const noexcept
Given a hash_type, find which of the 12 cache entries is to be used.
Signature hash type wrapper class.
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metricsOut, ScriptError *serror=nullptr)
Execute an unlocking and locking script together.
int FindAndDelete(CScript &script, const CScript &b)
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, SigHashType sigHashType, const Amount amount, const PrecomputedTransactionData *cache=nullptr, uint32_t flags=SCRIPT_ENABLE_SIGHASH_FORKID, SigHashCache *sighash_cache=nullptr)
bool CastToBool(const std::vector< uint8_t > &vch)
bool EvalScript(std::vector< std::vector< uint8_t > > &stack, const CScript &script, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metrics, ScriptError *error=nullptr)
opcodetype
Script opcodes.
@ SCRIPT_ENABLE_SIGHASH_FORKID
Precompute sighash midstate to avoid quadratic hashing.
Struct for holding cumulative results from executing a script or a sequence of scripts.