feat(wallet): confirm before stopping an adopted node to switch wallets
When switching wallets, the node the app would restart may be one this session ADOPTED — a dragonxd already running at launch (left up by "keep node running", or started by the user). Rather than stopping it silently (or the old dead-code "stop any external dragonxd first" refusal), show a "Stop the running node?" confirmation first; switching then stops it (RPC stop + wait for the port to fully free) and relaunches on the selected wallet. - switchToWallet(walletFile, stopDaemonConfirmed=false): when the node is adopted (externalDaemonDetected) and not yet confirmed, defer to the dialog and return. - renderSwitchStopDaemonDialog(): BlurFloat overlay (house style) with a warning header; confirm re-enters switchToWallet(w, true); cancel/X aborts, node keeps running. Owned nodes (started this session) still restart silently. - i18n (EN + 8 languages, additive) + CJK subset rebuild; modal-switch-stopnode sweep surface for visual review. Gate/re-entrancy adversarially verified (no state leak; owned switches ungated; prompt reappears on a reverted switch; dead-daemon-before-confirm handled). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1023,7 +1023,7 @@ void App::updateWalletIndexForActiveWallet(bool markOpened)
|
||||
if (wallet_index_.upsert(e)) wallet_index_.save();
|
||||
}
|
||||
|
||||
void App::switchToWallet(const std::string& walletFile)
|
||||
void App::switchToWallet(const std::string& walletFile, bool stopDaemonConfirmed)
|
||||
{
|
||||
if (!supportsFullNodeLifecycleActions()) {
|
||||
ui::Notifications::instance().warning("Full-node lifecycle actions are unavailable in lite build");
|
||||
@@ -1056,6 +1056,15 @@ void App::switchToWallet(const std::string& walletFile)
|
||||
ui::Notifications::instance().warning("Finish or cancel the pending send before switching wallets.");
|
||||
return;
|
||||
}
|
||||
// The node we'd restart may be one this session ADOPTED — a dragonxd already running when the wallet
|
||||
// launched (left running by "keep node running", or started by the user). Switching must stop+restart
|
||||
// it on the new wallet, so confirm first rather than killing a node the user may have kept up on
|
||||
// purpose. (An owned node we started this session restarts silently, as before.)
|
||||
if (!stopDaemonConfirmed && daemon_controller_ && daemon_controller_->externalDaemonDetected()) {
|
||||
pending_switch_wallet_file_ = walletFile;
|
||||
show_switch_stop_daemon_confirm_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Rescan only if this wallet was never synced in this datadir (freshly imported/new). One we've
|
||||
// loaded here before just catches up from its recorded block on start — fast.
|
||||
|
||||
Reference in New Issue
Block a user