aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-02-18 14:00:35 -0500
committerluigi1111 <luigi1111w@gmail.com>2021-02-18 14:00:35 -0500
commit3f55f7df318cf3c124daa79a2981045ceac2c26b (patch)
treecab0206dcf09f738f2d9273f130bc955485dd70e /src/simplewallet
parentMerge pull request #7226 (diff)
parentmonero-wallet-cli: Added command scan_tx (diff)
downloadmonero-3f55f7df318cf3c124daa79a2981045ceac2c26b.tar.xz
Merge pull request #7312
186271e monero-wallet-cli: Added command scan_tx (Horia Mihai David)
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp45
-rw-r--r--src/simplewallet/simplewallet.h1
2 files changed, 45 insertions, 1 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 309211ffb..c3df8a66f 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -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)
@@ -3764,6 +3804,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));
@@ -11668,4 +11712,3 @@ bool simple_wallet::mms(const std::vector<std::string> &args)
return true;
}
// End MMS ------------------------------------------------------------------------------------------------
-
diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h
index 61104c87f..af654e0dd 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -158,6 +158,7 @@ namespace cryptonote
bool set_credits_target(const std::vector<std::string> &args = std::vector<std::string>());
bool help(const std::vector<std::string> &args = std::vector<std::string>());
bool apropos(const std::vector<std::string> &args);
+ bool scan_tx(const std::vector<std::string> &args);
bool start_mining(const std::vector<std::string> &args);
bool stop_mining(const std::vector<std::string> &args);
bool set_daemon(const std::vector<std::string> &args);