|
|
|
@ -282,6 +282,7 @@ namespace
|
|
|
|
|
const char* USAGE_VERSION("version");
|
|
|
|
|
const char* USAGE_HELP("help [<command> | all]");
|
|
|
|
|
const char* USAGE_APROPOS("apropos <keyword> [<keyword> ...]");
|
|
|
|
|
const char* USAGE_SCAN_TX("scan_tx <txid> [<txid> ...]");
|
|
|
|
|
|
|
|
|
|
std::string input_line(const std::string& prompt, bool yesno = false)
|
|
|
|
|
{
|
|
|
|
@ -3214,6 +3215,45 @@ bool simple_wallet::apropos(const std::vector<std::string> &args)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool simple_wallet::scan_tx(const std::vector<std::string> &args)
|
|
|
|
|
{
|
|
|
|
|
if (args.empty())
|
|
|
|
|
{
|
|
|
|
|
PRINT_USAGE(USAGE_SCAN_TX);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse and dedup args
|
|
|
|
|
std::unordered_set<crypto::hash> txids;
|
|
|
|
|
for (const auto &s : args) {
|
|
|
|
|
crypto::hash txid;
|
|
|
|
|
if (!epee::string_tools::hex_to_pod(s, txid)) {
|
|
|
|
|
fail_msg_writer() << tr("Invalid txid specified: ") << s;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
txids.insert(txid);
|
|
|
|
|
}
|
|
|
|
|
std::vector<crypto::hash> txids_v(txids.begin(), txids.end());
|
|
|
|
|
|
|
|
|
|
if (!m_wallet->is_trusted_daemon()) {
|
|
|
|
|
message_writer(console_color_red, true) << tr("WARNING: this operation may reveal the txids to the remote node and affect your privacy");
|
|
|
|
|
if (!command_line::is_yes(input_line("Do you want to continue?", true))) {
|
|
|
|
|
message_writer() << tr("You have canceled the operation");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOCK_IDLE_SCOPE();
|
|
|
|
|
m_in_manual_refresh.store(true);
|
|
|
|
|
try {
|
|
|
|
|
m_wallet->scan_tx(txids_v);
|
|
|
|
|
} catch (const std::exception &e) {
|
|
|
|
|
fail_msg_writer() << e.what();
|
|
|
|
|
}
|
|
|
|
|
m_in_manual_refresh.store(false);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
simple_wallet::simple_wallet()
|
|
|
|
|
: m_allow_mismatched_daemon_version(false)
|
|
|
|
|
, m_refresh_progress_reporter(*this)
|
|
|
|
@ -3763,6 +3803,10 @@ simple_wallet::simple_wallet()
|
|
|
|
|
boost::bind(&simple_wallet::on_command, this, &simple_wallet::apropos, _1),
|
|
|
|
|
tr(USAGE_APROPOS),
|
|
|
|
|
tr("Search all command descriptions for keyword(s)"));
|
|
|
|
|
m_cmd_binder.set_handler("scan_tx",
|
|
|
|
|
boost::bind(&simple_wallet::on_command, this, &simple_wallet::scan_tx, _1),
|
|
|
|
|
tr(USAGE_SCAN_TX),
|
|
|
|
|
tr("Scan the transactions given by <txid>(s), processing them and looking for outputs"));
|
|
|
|
|
m_cmd_binder.set_unknown_command_handler(boost::bind(&simple_wallet::on_command, this, &simple_wallet::on_unknown_command, _1));
|
|
|
|
|
m_cmd_binder.set_empty_command_handler(boost::bind(&simple_wallet::on_empty_command, this));
|
|
|
|
|
m_cmd_binder.set_cancel_handler(boost::bind(&simple_wallet::on_cancelled_command, this));
|
|
|
|
@ -11648,4 +11692,3 @@ bool simple_wallet::mms(const std::vector<std::string> &args)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// End MMS ------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|