Merge pull request #7113

7f30c49 simplewallet: don't complain about connecting to the daemon when offline (moneromooo-monero)
This commit is contained in:
luigi1111 2021-01-15 23:44:32 -05:00
commit d01f31460e
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
2 changed files with 10 additions and 4 deletions

View File

@ -4765,9 +4765,14 @@ bool simple_wallet::try_connect_to_daemon(bool silent, uint32_t* version)
if (!m_wallet->check_connection(version)) if (!m_wallet->check_connection(version))
{ {
if (!silent) if (!silent)
{
if (m_wallet->is_offline())
fail_msg_writer() << tr("wallet failed to connect to daemon, because it is set to offline mode");
else
fail_msg_writer() << tr("wallet failed to connect to daemon: ") << m_wallet->get_daemon_address() << ". " << fail_msg_writer() << tr("wallet failed to connect to daemon: ") << m_wallet->get_daemon_address() << ". " <<
tr("Daemon either is not started or wrong port was passed. " tr("Daemon either is not started or wrong port was passed. "
"Please make sure daemon is running or change the daemon address using the 'set_daemon' command."); "Please make sure daemon is running or change the daemon address using the 'set_daemon' command.");
}
return false; return false;
} }
if (!m_allow_mismatched_daemon_version && ((*version >> 16) != CORE_RPC_VERSION_MAJOR)) if (!m_allow_mismatched_daemon_version && ((*version >> 16) != CORE_RPC_VERSION_MAJOR))
@ -9298,7 +9303,7 @@ bool simple_wallet::run()
refresh_main(0, ResetNone, true); refresh_main(0, ResetNone, true);
m_auto_refresh_enabled = m_wallet->auto_refresh(); m_auto_refresh_enabled = !m_wallet->is_offline() && m_wallet->auto_refresh();
m_idle_thread = boost::thread([&]{wallet_idle_thread();}); m_idle_thread = boost::thread([&]{wallet_idle_thread();});
message_writer(console_color_green, false) << "Background refresh thread started"; message_writer(console_color_green, false) << "Background refresh thread started";

View File

@ -1549,6 +1549,7 @@ private:
void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash); void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash);
void enable_dns(bool enable) { m_use_dns = enable; } void enable_dns(bool enable) { m_use_dns = enable; }
void set_offline(bool offline = true); void set_offline(bool offline = true);
bool is_offline() const { return m_offline; }
uint64_t credits() const { return m_rpc_payment_state.credits; } uint64_t credits() const { return m_rpc_payment_state.credits; }
void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const { expected_spent = m_rpc_payment_state.expected_spent; discrepancy = m_rpc_payment_state.discrepancy; } void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const { expected_spent = m_rpc_payment_state.expected_spent; discrepancy = m_rpc_payment_state.discrepancy; }