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
+2 -1
View File
@@ -663,7 +663,7 @@ static std::string scanBinaryVersion(const uint8_t* data, std::size_t size)
return "";
}
DaemonBinaryInfo getInstalledDaemonInfo()
DaemonBinaryInfo getInstalledDaemonInfo(bool scanVersion)
{
DaemonBinaryInfo info;
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).
if (!scanVersion) return info;
std::ifstream f(info.path, std::ios::binary);
if (f) {
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).
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).
BundledDaemonInfo getBundledDaemonInfo();
// Force-overwrite the installed dragonx binaries (dragonxd/cli/tx) with the bundled ones. The