fix: macOS block index corruption, dbcache auto-sizing, import key rescan height

- Shutdown: 3-phase stop (wait for RPC stop → SIGTERM → SIGKILL) prevents
  LevelDB flush interruption on macOS/APFS that caused full re-sync on restart
- dbcache: auto-detect RAM and set -dbcache to 12.5% (clamped 450-4096 MB)
  on macOS (sysctl), Linux (sysconf), and Windows (GlobalMemoryStatusEx)
- Import key: pass user-entered start height to z_importkey and trigger
  rescanblockchain from that height for t-key imports
- Bump version to 1.1.1
This commit is contained in:
2026-03-25 11:00:14 -05:00
parent 9ed4fbc476
commit e0bfeb2f29
6 changed files with 109 additions and 25 deletions

View File

@@ -2124,15 +2124,19 @@ void App::stopEmbeddedDaemon()
}
if (stop_sent) {
DEBUG_LOGF("Waiting for daemon to begin shutdown...\n");
shutdown_status_ = "Waiting for daemon to begin shutdown...";
std::this_thread::sleep_for(std::chrono::milliseconds(500));
DEBUG_LOGF("Waiting for daemon to flush block index and shut down...\n");
shutdown_status_ = "Waiting for daemon to flush block index...";
// Give the daemon time to flush LevelDB to disk before we
// escalate to SIGTERM. On macOS/APFS, LevelDB compaction +
// fsync can take 15-20s on a large chain. The stop() method
// will wait this long for a *natural* exit (via the RPC stop
// we already sent) before falling back to SIGTERM.
}
// Wait for process to exit; SIGTERM/TerminateProcess as last resort.
// 10 seconds is generous — if the daemon hasn't exited by then it's stuck.
shutdown_status_ = "Waiting for dragonxd process to exit...";
embedded_daemon_->stop(10000);
// 20s grace period for the RPC "stop" to complete (LevelDB flush).
// Only after that does stop() escalate to SIGTERM, then SIGKILL.
embedded_daemon_->stop(20000);
}
bool App::isEmbeddedDaemonRunning() const