perf(startup): stat dragonxd instead of reading it for the update offer

On Windows every full-node launch read the whole installed dragonxd.exe
(about 16.7 MB) on the UI thread and byte-scanned it for a version
string, to decide whether to offer the bundled node, which only needs
whether the file exists and its size. getInstalledDaemonInfo() takes a
scanVersion flag, and the update offer now only stats the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 21:09:48 -05:00
co-authored by Claude Opus 5.5
parent a700d2c7ee
commit 47180ff840
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -4298,7 +4298,7 @@ void App::maybeOfferDaemonUpdate()
{ {
if (!supportsFullNodeLifecycleActions()) return; // lite / no embedded-daemon build if (!supportsFullNodeLifecycleActions()) return; // lite / no embedded-daemon build
if (capture_mode_ || !settings_) return; // never during a UI sweep if (capture_mode_ || !settings_) return; // never during a UI sweep
auto inst = resources::getInstalledDaemonInfo(); auto inst = resources::getInstalledDaemonInfo(/*scanVersion=*/false); // only exists/size are used here
auto bun = resources::getBundledDaemonInfo(); auto bun = resources::getBundledDaemonInfo();
// Only when a daemon is ALREADY installed and its size differs from the bundled one — an absent // Only when a daemon is ALREADY installed and its size differs from the bundled one — an absent
// daemon is extracted normally, and a same-size match needs nothing. Fire once per bundled // daemon is extracted normally, and a same-size match needs nothing. Fire once per bundled
+2 -1
View File
@@ -663,7 +663,7 @@ static std::string scanBinaryVersion(const uint8_t* data, std::size_t size)
return ""; return "";
} }
DaemonBinaryInfo getInstalledDaemonInfo() DaemonBinaryInfo getInstalledDaemonInfo(bool scanVersion)
{ {
DaemonBinaryInfo info; DaemonBinaryInfo info;
std::string daemonDir = getDaemonDirectory(); std::string daemonDir = getDaemonDirectory();
@@ -688,6 +688,7 @@ DaemonBinaryInfo getInstalledDaemonInfo()
} }
// Read the binary and scan for its version stamp (one-off; caller caches the result). // Read the binary and scan for its version stamp (one-off; caller caches the result).
if (!scanVersion) return info;
std::ifstream f(info.path, std::ios::binary); std::ifstream f(info.path, std::ios::binary);
if (f) { if (f) {
f.seekg(0, std::ios::end); f.seekg(0, std::ios::end);
+2 -1
View File
@@ -48,7 +48,8 @@ struct BundledDaemonInfo {
}; };
// Read + scan the installed dragonxd (reads the file; call off the UI thread or cache the result). // Read + scan the installed dragonxd (reads the file; call off the UI thread or cache the result).
DaemonBinaryInfo getInstalledDaemonInfo(); // scanVersion=false: stat only (exists / size / modifiedEpoch), no 16 MB read.
DaemonBinaryInfo getInstalledDaemonInfo(bool scanVersion = true);
// Info about the bundled daemon (scans the embedded bytes once, cached). // Info about the bundled daemon (scans the embedded bytes once, cached).
BundledDaemonInfo getBundledDaemonInfo(); BundledDaemonInfo getBundledDaemonInfo();
// Force-overwrite the installed dragonx binaries (dragonxd/cli/tx) with the bundled ones. The // Force-overwrite the installed dragonx binaries (dragonxd/cli/tx) with the bundled ones. The