|
|
|
@ -2491,6 +2491,7 @@ simple_wallet::simple_wallet()
|
|
|
|
|
tr("Show the unspent outputs of a specified address within an optional amount range."));
|
|
|
|
|
m_cmd_binder.set_handler("rescan_bc",
|
|
|
|
|
boost::bind(&simple_wallet::rescan_blockchain, this, _1),
|
|
|
|
|
tr("rescan_bc [hard]"),
|
|
|
|
|
tr("Rescan the blockchain from scratch, losing any information which can not be recovered from the blockchain itself."));
|
|
|
|
|
m_cmd_binder.set_handler("set_tx_note",
|
|
|
|
|
boost::bind(&simple_wallet::set_tx_note, this, _1),
|
|
|
|
@ -4237,15 +4238,15 @@ boost::optional<epee::wipeable_string> simple_wallet::on_get_password(const char
|
|
|
|
|
return pwd_container->password();
|
|
|
|
|
}
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
|
bool simple_wallet::refresh_main(uint64_t start_height, bool reset, bool is_init)
|
|
|
|
|
bool simple_wallet::refresh_main(uint64_t start_height, enum ResetType reset, bool is_init)
|
|
|
|
|
{
|
|
|
|
|
if (!try_connect_to_daemon(is_init))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
LOCK_IDLE_SCOPE();
|
|
|
|
|
|
|
|
|
|
if (reset)
|
|
|
|
|
m_wallet->rescan_blockchain(false);
|
|
|
|
|
if (reset != ResetNone)
|
|
|
|
|
m_wallet->rescan_blockchain(reset == ResetHard, false);
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_READLINE
|
|
|
|
|
rdln::suspend_readline pause_readline;
|
|
|
|
@ -4324,7 +4325,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
|
|
|
|
|
start_height = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return refresh_main(start_height, false);
|
|
|
|
|
return refresh_main(start_height, ResetNone);
|
|
|
|
|
}
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
|
bool simple_wallet::show_balance_unlocked(bool detailed)
|
|
|
|
@ -6982,15 +6983,29 @@ bool simple_wallet::unspent_outputs(const std::vector<std::string> &args_)
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
|
bool simple_wallet::rescan_blockchain(const std::vector<std::string> &args_)
|
|
|
|
|
{
|
|
|
|
|
message_writer() << tr("Warning: this will lose any information which can not be recovered from the blockchain.");
|
|
|
|
|
message_writer() << tr("This includes destination addresses, tx secret keys, tx notes, etc");
|
|
|
|
|
std::string confirm = input_line(tr("Rescan anyway ? (Y/Yes/N/No): "));
|
|
|
|
|
if(!std::cin.eof())
|
|
|
|
|
bool hard = false;
|
|
|
|
|
if (!args_.empty())
|
|
|
|
|
{
|
|
|
|
|
if (!command_line::is_yes(confirm))
|
|
|
|
|
if (args_[0] != "hard")
|
|
|
|
|
{
|
|
|
|
|
fail_msg_writer() << tr("usage: rescan_bc [hard]");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
hard = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hard)
|
|
|
|
|
{
|
|
|
|
|
message_writer() << tr("Warning: this will lose any information which can not be recovered from the blockchain.");
|
|
|
|
|
message_writer() << tr("This includes destination addresses, tx secret keys, tx notes, etc");
|
|
|
|
|
std::string confirm = input_line(tr("Rescan anyway ? (Y/Yes/N/No): "));
|
|
|
|
|
if(!std::cin.eof())
|
|
|
|
|
{
|
|
|
|
|
if (!command_line::is_yes(confirm))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return refresh_main(0, true);
|
|
|
|
|
return refresh_main(0, hard ? ResetHard : ResetSoft, true);
|
|
|
|
|
}
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
|
void simple_wallet::wallet_idle_thread()
|
|
|
|
@ -7038,7 +7053,7 @@ bool simple_wallet::run()
|
|
|
|
|
// check and display warning, but go on anyway
|
|
|
|
|
try_connect_to_daemon();
|
|
|
|
|
|
|
|
|
|
refresh_main(0, false, true);
|
|
|
|
|
refresh_main(0, ResetNone, true);
|
|
|
|
|
|
|
|
|
|
m_auto_refresh_enabled = m_wallet->auto_refresh();
|
|
|
|
|
m_idle_thread = boost::thread([&]{wallet_idle_thread();});
|
|
|
|
|