36 std::cout <<
"Script executed without errors" << std::endl;
46 }
else if (opcode ==
OP_0 || (opcode >=
OP_1 && opcode <=
OP_16)) {
64 std::cout <<
"======= " << title <<
" =======" << std::endl;
75 std::cout << std::endl;
91 std::cerr << title <<
" failed execution: ";
92 if (
trace.errorMsg.size() > 0) {
93 std::cerr <<
trace.errorMsg;
97 std::cerr << std::endl;
105 std::cout <<
strprintf(
" Stack (%d item%s):", stacks.
stack.size(),
106 stacks.
stack.size() == 1 ?
"" :
"s");
107 if (stacks.
stack.empty()) {
108 std::cout <<
" (empty stack)";
110 std::cout << std::endl;
118 " Altstack (%d item%s):", stacks.
altstack.size(),
119 stacks.
altstack.size() == 1 ?
"" :
"s")
131 std::cout <<
"Number of sigChecks: " << metrics.
nSigChecks << std::endl;
144 std::cout <<
"scriptName,index,opcode,";
146 std::cout <<
"stack " << idx <<
",";
149 std::cout <<
"altstack " << idx <<
",";
151 std::cout << std::endl;
171 std::cout <<
"Script executed without errors" << std::endl;
199 std::cout << std::endl;
207 std::cout <<
traceName <<
" failed execution: ";
208 if (
trace.errorMsg.size() > 0) {
209 std::cout <<
trace.errorMsg;
213 std::cout << std::endl;
233 for (
const std::vector<uint8_t> &item : stack) {
235 std::cout <<
"(empty)";
237 std::cout <<
"\"" <<
HexStr(item) <<
"\"";
245 std::cout <<
"#sigChecks"
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::string GetOpName(opcodetype opcode)
opcodetype
Script opcodes.
std::string ScriptErrorString(const ScriptError serror)
IguanaTrace traceScriptSig
IguanaTrace traceScriptPubKey
ScriptExecutionMetrics metrics
std::optional< IguanaTrace > traceRedeemScript
std::vector< std::vector< uint8_t > > stack
std::vector< std::vector< uint8_t > > altstack
std::vector< uint8_t > pushdata
std::vector< IguanaTraceEntry > entries
Struct for holding cumulative results from executing a script or a sequence of scripts.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.