6 #ifndef BITCOIN_SCRIPT_INTERPRETER_H
7 #define BITCOIN_SCRIPT_INTERPRETER_H
170 void Init(
const T& tx, std::vector<CTxOut>&& spent_outputs);
266 bool CheckECDSASignature(
const std::vector<unsigned char>& scriptSig,
const std::vector<unsigned char>& vchPubKey,
const CScript& scriptCode,
SigVersion sigversion)
const override;
311 #endif // BITCOIN_SCRIPT_INTERPRETER_H
Witness v0 (P2WPKH and P2WSH); see BIP 141.
virtual ~BaseSignatureChecker()
bool CheckLockTime(const CScriptNum &nLockTime) const override
Witness v1 with 32-byte program, not BIP16 P2SH-wrapped, key path spending; see BIP 341...
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror=nullptr)
enum ScriptError_t ScriptError
static constexpr size_t WITNESS_V1_TAPROOT_SIZE
DeferringSignatureChecker(BaseSignatureChecker &checker)
GenericTransactionSignatureChecker(const T *txToIn, unsigned int nInIn, const CAmount &amountIn, const PrecomputedTransactionData &txdataIn)
Taproot only; implied when sighash byte is missing, and equivalent to SIGHASH_ALL.
bool CheckSchnorrSignature(Span< const unsigned char > sig, Span< const unsigned char > pubkey, SigVersion sigversion, const ScriptExecutionData &execdata, ScriptError *serror=nullptr) const override
uint256 m_spent_amounts_single_hash
bool m_annex_present
Whether an annex is present.
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache=nullptr)
GenericTransactionSignatureChecker(const T *txToIn, unsigned int nInIn, const CAmount &amountIn)
int64_t m_validation_weight_left
How much validation weight is left (decremented for every successful non-empty signature check)...
std::vector< CTxOut > m_spent_outputs
static constexpr uint8_t TAPROOT_LEAF_TAPSCRIPT
bool CheckSignatureEncoding(const std::vector< unsigned char > &vchSig, unsigned int flags, ScriptError *serror)
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
Witness v1 with 32-byte program, not BIP16 P2SH-wrapped, script path spending, leaf version 0xc0; see...
bool CheckSchnorrSignature(Span< const unsigned char > sig, Span< const unsigned char > pubkey, SigVersion sigversion, const ScriptExecutionData &execdata, ScriptError *serror=nullptr) const override
static constexpr size_t TAPROOT_CONTROL_BASE_SIZE
uint32_t m_codeseparator_pos
Opcode position of the last executed OP_CODESEPARATOR (or 0xFFFFFFFF if none executed).
bool CheckECDSASignature(const std::vector< unsigned char > &scriptSig, const std::vector< unsigned char > &vchPubKey, const CScript &scriptCode, SigVersion sigversion) const override
static constexpr size_t TAPROOT_CONTROL_NODE_SIZE
int64_t CAmount
Amount in satoshis (Can be negative)
bool m_annex_init
Whether m_annex_present and (when needed) m_annex_hash are initialized.
virtual bool VerifySchnorrSignature(Span< const unsigned char > sig, const XOnlyPubKey &pubkey, const uint256 &sighash) const
uint256 m_tapleaf_hash
The tapleaf hash.
bool CheckSequence(const CScriptNum &nSequence) const override
bool error(const char *fmt, const Args &...args)
const PrecomputedTransactionData * txdata
virtual bool CheckECDSASignature(const std::vector< unsigned char > &scriptSig, const std::vector< unsigned char > &vchPubKey, const CScript &scriptCode, SigVersion sigversion) const
static constexpr uint8_t TAPROOT_LEAF_MASK
An encapsulated public key.
bool m_bip143_segwit_ready
Whether the 3 fields above are initialized.
uint256 m_outputs_single_hash
bool CheckLockTime(const CScriptNum &nLockTime) const override
virtual bool CheckLockTime(const CScriptNum &nLockTime) const
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptExecutionData &execdata, ScriptError *error=nullptr)
bool CheckECDSASignature(const std::vector< unsigned char > &scriptSig, const std::vector< unsigned char > &vchPubKey, const CScript &scriptCode, SigVersion sigversion) const override
An output of a transaction.
static constexpr size_t WITNESS_V0_SCRIPTHASH_SIZE
Signature hash sizes.
bool m_bip341_taproot_ready
Whether the 5 fields above are initialized.
static constexpr size_t TAPROOT_CONTROL_MAX_SIZE
virtual bool CheckSequence(const CScriptNum &nSequence) const
bool m_codeseparator_pos_init
Whether m_codeseparator_pos is initialized.
static constexpr size_t TAPROOT_CONTROL_MAX_NODE_COUNT
size_t CountWitnessSigOps(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags)
Serialized script, used inside transaction inputs and outputs.
static constexpr size_t WITNESS_V0_KEYHASH_SIZE
bool m_spent_outputs_ready
Whether m_spent_outputs is initialized.
virtual bool VerifyECDSASignature(const std::vector< unsigned char > &vchSig, const CPubKey &vchPubKey, const uint256 &sighash) const
virtual bool CheckSchnorrSignature(Span< const unsigned char > sig, Span< const unsigned char > pubkey, SigVersion sigversion, const ScriptExecutionData &execdata, ScriptError *serror=nullptr) const
bool m_tapleaf_hash_init
Whether m_tapleaf_hash is initialized.
int FindAndDelete(CScript &script, const CScript &b)
PrecomputedTransactionData()=default
A Span is an object that can refer to a contiguous sequence of objects.
The basic transaction that is broadcasted on the network and contained in blocks. ...
bool CheckSequence(const CScriptNum &nSequence) const override
uint256 m_spent_scripts_single_hash
void Init(const T &tx, std::vector< CTxOut > &&spent_outputs)
uint256 m_sequences_single_hash
uint256 m_prevouts_single_hash
uint256 m_annex_hash
Hash of the annex data.
BaseSignatureChecker & m_checker
bool m_validation_weight_left_init
Whether m_validation_weight_left is initialized.