simplewallet: suggest hw_reconnect on refresh
What changed, and why it matters
This change only improves an error message shown in Monero's command-line wallet when a refresh fails. If the wallet uses a hardware device (like a Ledger or Trezor) and refresh fails unexpectedly, it now tells the user to check the device connection and run a reconnect command. There is no code fix for an underlying bug and no security vulnerability is apparent.
No security action required. Treat as a routine UX improvement.
Security signals we found
No memory safety, cryptographic, or authorization changes
No input validation or parsing changes
User-facing error-message improvement only
No bug fix for an underlying failure condition
Evidence from the diff
The patch adds a boolean flag suggest_hw_reconnect that is set to true only in the generic catch (...) unexpected-error handler inside simple_wallet::refresh_main(). When refresh fails (!ok) and the wallet keys are on a hardware device, the failure message appends a user-facing hint to check/unlock the hardware wallet and run hw_reconnect. It does not change refresh logic, exception handling, cryptography, or network behavior.
Changed components
src/simplewallet/simplewallet.cppsimple_wallet::refresh_main()Inspect captured patch +6 / −1
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 4853a66..b3ba033 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -5621,6 +5621,7 @@ bool simple_wallet::refresh_main(uint64_t start_height, enum ResetType reset, bo
uint64_t fetched_blocks = 0;
bool received_money = false;
bool ok = false;
+ bool suggest_hw_reconnect = false;
std::ostringstream ss;
try
{
@@ -5682,6 +5683,7 @@ bool simple_wallet::refresh_main(uint64_t start_height, enum ResetType reset, bo
{
LOG_ERROR("unexpected error: " << e.what());
ss << tr("unexpected error: ") << e.what();
+ suggest_hw_reconnect = true;
}
catch (...)
{
@@ -5691,7 +5693,10 @@ bool simple_wallet::refresh_main(uint64_t start_height, enum ResetType reset, bo
if (!ok)
{
- fail_msg_writer() << tr("refresh failed: ") << ss.str() << ". " << tr("Blocks received: ") << fetched_blocks;
+ auto writer = fail_msg_writer();
+ writer << tr("refresh failed: ") << ss.str() << ". " << tr("Blocks received: ") << fetched_blocks;
+ if (suggest_hw_reconnect && m_wallet->key_on_device())
+ writer << "\n" << tr("Check that the HW wallet is connected and unlocked, then run 'hw_reconnect' before refreshing again.");
}
// prevent it from triggering the idle screen due to waiting for a foreground refresh
Why this scored 20/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.