28 args.
AddArg(
"-tx",
"Raw tx hex to run the debugger for (required)",
34 args.
AddArg(
"-scriptpubkey",
35 "Hex of the scriptPubKey of the output being spent (required)",
38 "Value (in sats) of the output being spent (required)",
41 strprintf(
"Output format for the debug trace (Options: human, "
47int main(
int argc,
char *argv[]) {
54 std::cerr <<
"Error parsing command line arguments: " <<
error
65 std::cout <<
"Usage: iguana [options]" << std::endl;
71 std::unique_ptr<IguanaFormatter> formatter;
72 if (outputFormat ==
"human") {
74 }
else if (outputFormat ==
"csv") {
77 std::cerr <<
"Unsupported output format " << outputFormat << std::endl;
81 std::vector<std::string> missingArgs;
83 missingArgs.push_back(
"-tx");
85 if (!args.
IsArgSet(
"-scriptpubkey")) {
86 missingArgs.push_back(
"-scriptpubkey");
89 missingArgs.push_back(
"-value");
91 if (!missingArgs.empty()) {
92 std::cerr <<
"Missing required args " <<
Join(missingArgs,
", ") <<
". "
93 <<
"Provide -h to see a description for each." << std::endl;
97 std::string tx_hex = args.
GetArg(
"-tx",
"");
98 std::vector<uint8_t> tx_raw =
ParseHex(tx_hex);
103 const int64_t inputIndex =
106 if (inputIndex < 0 || tx.
vin.size() <= (
size_t)inputIndex) {
107 std::cerr <<
"Transaction doesn't have input index " << inputIndex
114 std::string scriptPubKeyHex = args.
GetArg(
"-scriptpubkey",
"");
115 std::vector<uint8_t> scriptPubKeyRaw =
ParseHex(scriptPubKeyHex);
116 CScript scriptPubKey(scriptPubKeyRaw.begin(), scriptPubKeyRaw.end());
117 CTxOut txout(value, scriptPubKey);
126 if (!formatter->Format(result)) {
bool HelpRequested(const ArgsManager &args)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
bool ParseParameters(int argc, const char *const argv[], std::string &error)
std::string GetHelpMessage() const
Get the help string.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
Double ended buffer combining vector and stream-like interfaces.
A mutable version of CTransaction.
An output of a transaction.
Users of this module must hold an ECCVerifyHandle.
std::string FormatFullVersion()
int main(int argc, char *argv[])
const std::function< std::string(const char *)> G_TRANSLATION_FUN
Translate string to current locale using Qt.
const int64_t DEFAULT_INPUT_INDEX
const std::string DEFAULT_FORMAT
void SetupIguanaArgs(ArgsManager &args)
bool error(const char *fmt, const Args &...args)
def iguana(*args, expected_stderr="", expected_returncode=None)
static constexpr uint32_t STANDARD_SCRIPT_VERIFY_FLAGS
Standard script verification flags that standard transactions will comply with.
Span< const std::byte > MakeByteSpan(V &&v) noexcept
auto Join(const std::vector< T > &list, const BaseType &separator, UnaryOp unary_op) -> decltype(unary_op(list.at(0)))
Join a list of items.
static constexpr Amount satoshi() noexcept
template std::vector< std::byte > ParseHex(std::string_view)