aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-06-20 14:44:54 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-06-20 14:44:54 -0500
commit3721298cf6fc49202efc56ecf10ea12f6a05fdf5 (patch)
tree2c36da00159e3c42a702fa08a40f0a39db4a42b8 /src/simplewallet
parentMerge pull request #3927 (diff)
parentREADME: mention --untrusted-daemon (diff)
downloadmonero-3721298cf6fc49202efc56ecf10ea12f6a05fdf5.tar.xz
Merge pull request #3932
8962f00 simplewallet: add optional trusted/untrusted argument to set_daemon (moneromooo-monero) 941a608 util: consider Tor/I2P addresses to be non local (moneromooo-monero) 2b3357e README: mention --untrusted-daemon (moneromooo-monero)
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 61eb43e45..5576a024f 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -2134,7 +2134,7 @@ simple_wallet::simple_wallet()
tr("Stop mining in the daemon."));
m_cmd_binder.set_handler("set_daemon",
boost::bind(&simple_wallet::set_daemon, this, _1),
- tr("set_daemon <host>[:<port>]"),
+ tr("set_daemon <host>[:<port>] [trusted|untrusted]"),
tr("Set another daemon to connect to."));
m_cmd_binder.set_handler("save_bc",
boost::bind(&simple_wallet::save_bc, this, _1),
@@ -3900,6 +3900,33 @@ bool simple_wallet::set_daemon(const std::vector<std::string>& args)
}
LOCK_IDLE_SCOPE();
m_wallet->init(daemon_url);
+
+ if (args.size() == 2)
+ {
+ if (args[1] == "trusted")
+ m_trusted_daemon = true;
+ else if (args[1] == "untrusted")
+ m_trusted_daemon = false;
+ else
+ {
+ fail_msg_writer() << tr("Expected trusted or untrusted, got ") << args[1] << ": assuming untrusted";
+ m_trusted_daemon = false;
+ }
+ }
+ else
+ {
+ m_trusted_daemon = false;
+ try
+ {
+ if (tools::is_local_address(m_wallet->get_daemon_address()))
+ {
+ MINFO(tr("Daemon is local, assuming trusted"));
+ m_trusted_daemon = true;
+ }
+ }
+ catch (const std::exception &e) { }
+ }
+ success_msg_writer() << boost::format("Daemon set to %s, %s") % daemon_url % (*m_trusted_daemon ? tr("trusted") : tr("untrusted"));
} else {
fail_msg_writer() << tr("This does not seem to be a valid daemon URL.");
}