28 args.
AddArg(
"-tx",
"Raw tx hex to run the debugger for (required)",
36 args.
AddArg(
"-scriptpubkey",
37 "Hex of the scriptPubKey of the output being spent (required)",
41 "Value (in sats) of the output being spent (required)",
45 strprintf(
"Output format for the debug trace (Options: human, "
52int main(
int argc,
char *argv[]) {
59 std::cerr <<
"Error parsing command line arguments: " << error
70 std::cout <<
"Usage: iguana [options]" << std::endl;
76 std::unique_ptr<IguanaFormatter> formatter;
77 if (outputFormat ==
"human") {
79 }
else if (outputFormat ==
"csv") {
82 std::cerr <<
"Unsupported output format " << outputFormat << std::endl;
86 std::vector<std::string> missingArgs;
88 missingArgs.push_back(
"-tx");
90 if (!args.
IsArgSet(
"-scriptpubkey")) {
91 missingArgs.push_back(
"-scriptpubkey");
94 missingArgs.push_back(
"-value");
96 if (!missingArgs.empty()) {
97 std::cerr <<
"Missing required args " <<
Join(missingArgs,
", ") <<
". "
98 <<
"Provide -h to see a description for each." << std::endl;
102 std::string tx_hex = args.
GetArg(
"-tx",
"");
103 std::vector<uint8_t> tx_raw =
ParseHex(tx_hex);
108 const int64_t inputIndex =
111 if (inputIndex < 0 || tx.
vin.size() <= (
size_t)inputIndex) {
112 std::cerr <<
"Transaction doesn't have input index " << inputIndex
119 std::string scriptPubKeyHex = args.
GetArg(
"-scriptpubkey",
"");
120 std::vector<uint8_t> scriptPubKeyRaw =
ParseHex(scriptPubKeyHex);
121 CScript scriptPubKey(scriptPubKeyRaw.begin(), scriptPubKeyRaw.end());
122 CTxOut txout(value, scriptPubKey);
131 if (!formatter->Format(result)) {
bool HelpRequested(const ArgsManager &args)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
@ ALLOW_ANY
disable validation
@ DISALLOW_NEGATION
unimplemented, draft implementation in #16545
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.
A mutable version of CTransaction.
An output of a transaction.
Double ended buffer combining vector and stream-like interfaces.
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)
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)