mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 15:41:44 +02:00
Merge pull request #10976
029fa3d simplewallet: fix restore-date parameter when using generate-from-device (jpk68)
ACKs: selsta, tobtoht
This commit is contained in:
@@ -4288,8 +4288,8 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
|
||||
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
|
||||
password = *r;
|
||||
welcome = true;
|
||||
// if no block_height is specified, assume its a new account and start it "now"
|
||||
if (command_line::is_arg_defaulted(vm, arg_restore_height)) {
|
||||
// if no block_height or date is specified, assume it's a new account and start it "now"
|
||||
if (command_line::is_arg_defaulted(vm, arg_restore_height) && command_line::is_arg_defaulted(vm, arg_restore_date)) {
|
||||
{
|
||||
tools::scoped_message_writer wrt = tools::msg_writer();
|
||||
wrt << tr("No restore height is specified.") << " ";
|
||||
@@ -4304,6 +4304,23 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
|
||||
m_wallet->explicit_refresh_from_block_height(true);
|
||||
m_restore_height = m_wallet->get_refresh_from_block_height();
|
||||
}
|
||||
else if (command_line::is_arg_defaulted(vm, arg_restore_height) && !command_line::is_arg_defaulted(vm, arg_restore_date))
|
||||
{
|
||||
uint16_t year;
|
||||
uint8_t month, day;
|
||||
if (!datestr_to_int(m_restore_date, year, month, day)) return false;
|
||||
try
|
||||
{
|
||||
m_restore_height = m_wallet->get_blockchain_height_by_date(year, month, day);
|
||||
success_msg_writer() << tr("Restore height is: ") << m_restore_height;
|
||||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
fail_msg_writer() << e.what();
|
||||
return false;
|
||||
}
|
||||
m_wallet->explicit_refresh_from_block_height(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user