fix(wallet): wait for IPv6 port + retry start so a switch survives the DB-env race
Live logs showed the switch's new node starting on the correct wallet, reaching "Verifying wallet…", then aborting with "Binding RPC on ::1 port 21769 failed" + "Failed to rename wallet-savings.dat" — the OLD node's RPC port (on ::1/IPv6) and Berkeley DB environment weren't fully released yet, so the wallet-verify DB recovery couldn't rename the file. The app then reverted, and the connect loop brought a node up on the DEFAULT wallet. Two causes fixed: - isPortInUse() only probed 127.0.0.1 (IPv4). The daemon also binds ::1 (IPv6), which lingers after IPv4 releases — so the readiness wait returned "free" prematurely. Now probe BOTH families (Windows: IPv4 + ::1 via in6addr_loopback; Linux: /proc/net/tcp + tcp6). mingw-verified. - The datadir/DB-env can still be briefly held right after the old node exits, so the first start can abort. Retry the start (up to 6×, 2s backoff) with the CORRECT -wallet — active_wallet_file isn't reverted until we give up — resetting the crash count and re-arming -rescan each attempt, until one survives. Also: the "Wallet switch failed" modal no longer repeats its title in the warning header — it now shows the actual reason there. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3901,9 +3901,9 @@ void App::renderSwitchStopDaemonDialog()
|
||||
show_switch_stop_daemon_confirm_ = false;
|
||||
}
|
||||
} else if (failed) {
|
||||
ui::material::DialogWarningHeader(TR("switch_progress_failed_title"));
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingSm()));
|
||||
ImGui::TextWrapped("%s", wallet_switch_error_.c_str());
|
||||
// The title already says "Wallet switch failed" — put the actual reason in the warning header
|
||||
// rather than repeating the title.
|
||||
ui::material::DialogWarningHeader(wallet_switch_error_.c_str());
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingMd()));
|
||||
if (ui::material::TactileButton(TR("close"), ImVec2(110.0f * dp, 0))) {
|
||||
wallet_switch_dialog_open_.store(false);
|
||||
|
||||
Reference in New Issue
Block a user