simplewallet: indicate default choice in yes/no prompts
What changed, and why it matters
This commit only changes the text shown to users when Monero's command-line wallet asks yes/no questions. It replaces '(Y/Yes/N/No)' with '[y/N]' to make it clearer that 'No' is the default if the user just presses Enter. There is no security bug being fixed here.
No security action needed. This is a user-interface wording change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors simplewallet’s yes/no prompts. A helper function input_line() gains a yesno flag that prints ‘[y/N]’ after the prompt, and several call sites are updated to use this flag instead of hard-coding the prompt suffix. The underlying logic for interpreting answers (command_line::is_yes) and default handling remains unchanged. No input validation, authentication, cryptography, or network code is modified.
Changed components
src/simplewallet/simplewallet.cppInspect captured patch +5 / −5
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index a78c233..eebe708 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -288,7 +288,7 @@ namespace
PAUSE_READLINE();
std::cout << prompt;
if (yesno)
- std::cout << " (Y/Yes/N/No)";
+ std::cout << " [y/N]";
std::cout << ": " << std::flush;
std::string buf;
@@ -5189,7 +5189,7 @@ void simple_wallet::check_background_mining(const epee::wipeable_string &passwor
message_writer() << tr("The daemon is not set up to background mine.");
message_writer() << tr("With background mining enabled, the daemon will mine when idle and not on battery.");
message_writer() << tr("Enabling this supports the network you are using, and makes you eligible for receiving new monero");
- std::string accepted = input_line(tr("Do you want to do it now? (Y/Yes/N/No)"));
+ std::string accepted = input_line(tr("Do you want to do it now?"), true);
if (std::cin.eof() || !command_line::is_yes(accepted)) {
m_wallet->setup_background_mining(tools::wallet2::BackgroundMiningNo);
m_wallet->rewrite(m_wallet_file, password);
@@ -5584,7 +5584,7 @@ void simple_wallet::on_refresh_finished(uint64_t start_height, uint64_t fetched_
// Finished first refresh for HW device and money received -> KI sync
message_writer() << "\n" << tr("The first refresh has finished for the HW-based wallet with received money. hw_key_images_sync is needed. ");
- std::string accepted = input_line(tr("Do you want to do it now? (Y/Yes/N/No): "));
+ std::string accepted = input_line(tr("Do you want to do it now?"), true);
if (std::cin.eof() || !command_line::is_yes(accepted)) {
message_writer(console_color_red, false) << tr("hw_key_images_sync skipped. Run command manually before a transfer.");
return;
@@ -8904,7 +8904,7 @@ bool simple_wallet::rescan_blockchain(const std::vector<std::string> &args_)
if (start_height > wallet_from_height)
{
message_writer() << tr("Warning: your restore height is higher than wallet restore height: ") << wallet_from_height;
- std::string confirm = input_line(tr("Rescan anyway ? (Y/Yes/N/No): "));
+ std::string confirm = input_line(tr("Rescan anyway?"), true);
if(!std::cin.eof())
{
if (!command_line::is_yes(confirm))
@@ -10382,7 +10382,7 @@ int main(int argc, char* argv[])
bool simple_wallet::user_confirms(const std::string &question)
{
- std::string answer = input_line(question + tr(" (Y/Yes/N/No): "));
+ std::string answer = input_line(question, true);
return !std::cin.eof() && command_line::is_yes(answer);
}
Why this scored 15/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.