simplewallet: don't exit when unable to get restore date
What changed, and why it matters
This change makes the Monero command-line wallet more forgiving when a user provides a restore date but the wallet cannot reach the network daemon to convert that date into a blockchain height. Previously the wallet would quit with an error; now it prints a warning and continues using a default restore height. This is primarily a usability improvement, but it slightly increases the risk that a restored wallet might scan from the wrong (too recent or too old) block height, potentially missing transactions or scanning more than intended until the user manually corrects it.
Treat as a minor usability fix. If reviewing for security, verify that the default/fallback restore height is safe (e.g., does not default to 0 in a way that causes a wallet to skip scanning recent blocks), and consider requiring explicit user confirmation before continuing when the daemon lookup fails.
Security signals we found
Change in error-handling path from fatal to non-fatal
Potential for incorrect restore height to be used when daemon is unreachable
No cryptographic, consensus, or network protocol change
Evidence from the diff
In simplewallet.cpp, the catch block for std::runtime_error thrown by get_blockchain_height_by_date() no longer returns false (which aborted initialization). Instead it emits yellow console warnings and falls through. The call to explicit_refresh_from_block_height(true) was moved inside the try block so it only marks the height as explicit when the daemon lookup succeeded. If the lookup fails, m_restore_height retains whatever value it had before (likely 0 or a default), and initialization continues.
Changed components
src/simplewallet/simplewallet.cppsimplewallet restore-from-date initialization pathInspect captured patch +3 / −3
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 04bac19..f84cfd0 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -4323,13 +4323,13 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
{
m_restore_height = m_wallet->get_blockchain_height_by_date(year, month, day);
success_msg_writer() << tr("Restore height is: ") << m_restore_height;
+ m_wallet->explicit_refresh_from_block_height(true);
}
catch (const std::runtime_error& e)
{
- fail_msg_writer() << e.what();
- return false;
+ message_writer(console_color_yellow, true) << tr("Could not connect to daemon to convert --restore-date into a restore height: ") << e.what();
+ message_writer(console_color_yellow, true) << tr("Restore height is: ") << m_restore_height;
}
- m_wallet->explicit_refresh_from_block_height(true);
}
}
else
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.