feat(fullnode): manage the daemon binary in Settings; stop auto-overwriting it

Previously the wallet re-extracted the bundled dragonxd on startup whenever the
installed binary's size differed from the bundle ("stale" overwrite), which could
replace a node a user had deliberately placed in dragonx/.

Now dragonx binaries (dragonxd/cli/tx) are auto-placed ONLY when missing — never
auto-overwritten on a size mismatch (needsParamsExtraction + extractEmbeddedResources).
Params/asmap keep their size-based refresh; a daemon dropped next to the wallet exe
still takes priority and is never touched.

Replacing the daemon is now an explicit action: Settings → "Daemon binary" reports the
installed binary's version (scanned from the file), size and modified date, compares it
to the version bundled in this build, and offers an "Install bundled daemon" button.
That stops the node, overwrites dragonxd/cli/tx with the bundled copies (waiting for the
process to release the file lock), and restarts — wallet/keys/chain data untouched.

Adds resources::{getInstalledDaemonInfo,getBundledDaemonInfo,reextractBundledDaemon}
(+ a version-string scanner) and App::reinstallBundledDaemon().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 21:06:59 -05:00
co-authored by Claude Opus 4.8
parent de70e68472
commit b2e104358d
6 changed files with 316 additions and 13 deletions
+25
View File
@@ -30,6 +30,31 @@ bool needsParamsExtraction();
// Get the params directory path
std::string getParamsDirectory();
// --- Daemon binary management (Settings → daemon binary panel) ------------------------------
// Info about the dragonxd binary currently installed in the dragonx/ extraction directory.
struct DaemonBinaryInfo {
bool exists = false;
std::string path;
std::uintmax_t size = 0;
std::string version; // scanned from the binary ("vX.Y.Z-<commit>"), empty if not found
std::int64_t modifiedEpoch = 0; // last-write time as unix epoch seconds, 0 if unknown
};
// Info about the dragonxd binary bundled inside this wallet build.
struct BundledDaemonInfo {
bool available = false; // a daemon resource is embedded in this build
std::uintmax_t size = 0;
std::string version;
};
// Read + scan the installed dragonxd (reads the file; call off the UI thread or cache the result).
DaemonBinaryInfo getInstalledDaemonInfo();
// 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
// caller should stop the daemon first. Returns true if all present resources were written.
bool reextractBundledDaemon();
// Resource names
constexpr const char* RESOURCE_SAPLING_SPEND = "sapling-spend.params";
constexpr const char* RESOURCE_SAPLING_OUTPUT = "sapling-output.params";