fix(daemon): let DRAGONX.conf dbcache override the pinned value

The wallet pins a -dbcache value on the daemon command line. A
command-line flag overrides the same key in DRAGONX.conf, so a user who
set their own dbcache in the conf never got it: the wallet's pin always
won.

- Before spawning, a normal start now reads DRAGONX.conf once and, if it
  sets dbcache, drops the wallet's own -dbcache pin from the arguments
  so the user's value takes effect. An isolated start keeps its own
  datadir and conf and is left alone.
- The conf is now read a single time for both this check and the
  existing rpcthreads check instead of twice.

Tests cover dropping the pin when the conf sets dbcache (in various
forms), and leaving the default arguments untouched when it is
commented out, empty, or sets something else.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 06:26:13 -05:00
co-authored by Claude Opus 4.8
parent a6b7b966b0
commit 614dfbbc5b
3 changed files with 45 additions and 5 deletions
+13
View File
@@ -4,6 +4,7 @@
#pragma once
#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
@@ -424,6 +425,18 @@ public:
return false;
}
/**
* Drop the wallet's own -dbcache= pin from `args` when the user's DRAGONX.conf sets dbcache (a
* command-line flag overrides the conf, so the user's own value must win). Pure; no logging.
*/
static void dropPinnedDbcacheIfConfSets(std::vector<std::string>& args, const std::string& conf)
{
if (!confSetsKey(conf, "dbcache")) return;
args.erase(std::remove_if(args.begin(), args.end(),
[](const std::string& a) { return a.rfind("-dbcache=", 0) == 0; }),
args.end());
}
/** Decision returned by evaluateDatadirLockGate(): whether start() may spawn now. */
struct StartLockGateDecision {
bool proceed = true; // false => bail before spawning