Bitcoin ABC 0.30.5
P2P Digital Currency
iguana_interpreter.h
Go to the documentation of this file.
1// Copyright (c) 2024 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_IGUANA_IGUANA_INTERPRETER_H
6#define BITCOIN_IGUANA_IGUANA_INTERPRETER_H
7
9#include <script/script.h>
10
11#include <optional>
12#include <string>
13#include <vector>
14
15enum class ScriptError;
16
18 std::vector<std::vector<uint8_t>> stack;
19 std::vector<std::vector<uint8_t>> altstack;
20};
21
24 std::vector<uint8_t> pushdata;
26};
27
29 std::vector<IguanaTraceEntry> entries;
31 std::string errorMsg;
33};
34
38 std::optional<IguanaTrace> traceRedeemScript;
40};
41
43private:
45 uint32_t inputIndex;
46
48
50
52
53 uint32_t flags;
54
55public:
56 IguanaInterpreter(CMutableTransaction txIn, uint32_t inputIndexIn,
57 CTxOut spentOutput, uint32_t flagsIn)
58 : tx(txIn), inputIndex(inputIndexIn),
59 scriptPubKey(spentOutput.scriptPubKey), txdata(tx),
60 sigChecker(&tx, inputIndex, spentOutput.nValue, txdata),
61 flags(flagsIn) {}
62
67 IguanaResult Run() const;
68
69private:
71 bool isPushOnly) const;
72};
73
74#endif // BITCOIN_IGUANA_IGUANA_INTERPRETER_H
A mutable version of CTransaction.
Definition: transaction.h:274
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:431
An output of a transaction.
Definition: transaction.h:128
IguanaTrace RunScript(ScriptInterpreter &interpreter, bool isPushOnly) const
IguanaResult Run() const
Run the interpreter, stepping through the scripts and return the trace.
PrecomputedTransactionData txdata
CMutableTransaction tx
MutableTransactionSignatureChecker sigChecker
IguanaInterpreter(CMutableTransaction txIn, uint32_t inputIndexIn, CTxOut spentOutput, uint32_t flagsIn)
opcodetype
Script opcodes.
Definition: script.h:47
ScriptError
Definition: script_error.h:11
IguanaTrace traceScriptSig
IguanaTrace traceScriptPubKey
ScriptExecutionMetrics metrics
std::optional< IguanaTrace > traceRedeemScript
std::vector< std::vector< uint8_t > > stack
std::vector< std::vector< uint8_t > > altstack
IguanaStacks stacks
opcodetype opcode
std::vector< uint8_t > pushdata
std::vector< IguanaTraceEntry > entries
std::string errorMsg
IguanaStacks initialStacks
ScriptError scriptError
Precompute sighash midstate to avoid quadratic hashing.
Definition: transaction.h:325
Struct for holding cumulative results from executing a script or a sequence of scripts.