simplewallet: add (out of sync) or (no daemon) markers in the prompt

Should help people who don't realize why they haven't seen their
monero yet.
This commit is contained in:
moneromooo-monero 2017-08-02 14:44:42 +01:00
parent fa23a5006d
commit b7d6ec8364
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 31 additions and 13 deletions

View file

@ -3956,6 +3956,19 @@ void simple_wallet::wallet_idle_thread()
}
}
//----------------------------------------------------------------------------------------------------
std::string simple_wallet::get_prompt() const
{
std::string addr_start = m_wallet->get_account().get_public_address_str(m_wallet->testnet()).substr(0, 6);
std::string prompt = std::string("[") + tr("wallet") + " " + addr_start;
uint32_t version;
if (!m_wallet->check_connection(&version))
prompt += tr(" (no daemon)");
else if (!m_wallet->is_synced())
prompt += tr(" (out of sync)");
prompt += "]: ";
return prompt;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::run()
{
// check and display warning, but go on anyway
@ -3966,9 +3979,8 @@ bool simple_wallet::run()
m_auto_refresh_enabled = m_wallet->auto_refresh();
m_idle_thread = boost::thread([&]{wallet_idle_thread();});
std::string addr_start = m_wallet->get_account().get_public_address_str(m_wallet->testnet()).substr(0, 6);
message_writer(console_color_green, false) << "Background refresh thread started";
return m_cmd_binder.run_handling(std::string("[") + tr("wallet") + " " + addr_start + "]: ", "");
return m_cmd_binder.run_handling([this](){return get_prompt();}, "");
}
//----------------------------------------------------------------------------------------------------
void simple_wallet::stop()

View file

@ -182,6 +182,7 @@ namespace cryptonote
bool accept_loaded_tx(const tools::wallet2::unsigned_tx_set &txs);
bool accept_loaded_tx(const tools::wallet2::signed_tx_set &txs);
bool print_ring_members(const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr);
std::string get_prompt() const;
/*!
* \brief Prints the seed with a nice message