Rename hush→dragonx across wallet codebase

- Rename RESOURCE_HUSHD/HUSH_CLI/HUSH_TX to RESOURCE_DRAGONXD/DRAGONX_CLI/DRAGONX_TX
- Remove unused .bat resource constants (DRAGONXD_BAT, DRAGONX_CLI_BAT)
- Update INCBIN symbols: g_hushd_exe → g_dragonxd_exe, etc.
- Update daemon search paths, removing hush-arrakis-chain fallbacks
- Update process detection (Windows findProcessByName, Linux /proc/comm, macOS pgrep)
- Update build.sh: embed dragonxd.exe/dragonx-cli.exe/dragonx-tx.exe
- Overhaul setup.sh: fix binary names, release paths, add -j passthrough
- Update getDaemonPath/needsDaemonExtraction/hasDaemonAvailable for new names
This commit is contained in:
dan_s
2026-03-04 03:17:32 -06:00
parent 386cc857b0
commit 7fb1f1de9d
16 changed files with 416 additions and 195 deletions

View File

@@ -1324,15 +1324,20 @@ void App::startPoolMining(int threads)
cfg.tls = settings_->getPoolTls();
cfg.hugepages = settings_->getPoolHugepages();
// Use first transparent address as the mining wallet address
for (const auto& addr : state_.addresses) {
if (addr.type == "transparent" && !addr.address.empty()) {
// Use first shielded address as the mining wallet address, fall back to transparent
for (const auto& addr : state_.z_addresses) {
if (!addr.address.empty()) {
cfg.wallet_address = addr.address;
break;
}
}
if (cfg.wallet_address.empty() && !state_.z_addresses.empty()) {
cfg.wallet_address = state_.z_addresses[0].address;
if (cfg.wallet_address.empty()) {
for (const auto& addr : state_.addresses) {
if (addr.type == "transparent" && !addr.address.empty()) {
cfg.wallet_address = addr.address;
break;
}
}
}
if (cfg.wallet_address.empty()) {

View File

@@ -71,15 +71,10 @@ std::string EmbeddedDaemon::findDaemonBinary()
#ifdef _WIN32
// Check wallet's own directory for manually placed binaries
std::vector<std::string> localPaths = {
exe_dir + "\\hushd.exe",
exe_dir + "\\hush-arrakis-chain.exe",
exe_dir + "\\dragonxd.exe",
exe_dir + "\\dragonxd.bat",
};
#else
std::vector<std::string> localPaths = {
exe_dir + "/hush-arrakis-chain",
exe_dir + "/hushd",
exe_dir + "/dragonxd",
};
#endif
@@ -103,41 +98,36 @@ std::string EmbeddedDaemon::findDaemonBinary()
// ---------------------------------------------------------------
// 3. Search additional well-known locations
// ---------------------------------------------------------------
// IMPORTANT: Always prefer hushd.exe directly over dragonxd.bat
// IMPORTANT: Always prefer dragonxd.exe directly over .bat wrappers.
// Using .bat files causes issues because cmd.exe exits immediately
// while hushd.exe continues running, making process monitoring fail.
// while dragonxd.exe continues running, making process monitoring fail.
std::vector<std::string> search_paths;
#ifdef _WIN32
// Parent directory
if (!exe_dir.empty()) {
search_paths.push_back(exe_dir + "\\..\\hushd.exe");
search_paths.push_back(exe_dir + "\\..\\dragonxd.bat");
search_paths.push_back(exe_dir + "\\..\\dragonxd.exe");
}
search_paths.push_back("C:\\Program Files\\DragonX\\hushd.exe");
search_paths.push_back("C:\\Program Files\\DragonX\\dragonxd.exe");
#else
if (!exe_dir.empty()) {
search_paths.push_back(exe_dir + "/../hush-arrakis-chain");
search_paths.push_back(exe_dir + "/../bin/hush-arrakis-chain");
search_paths.push_back(exe_dir + "/../dragonxd");
}
// Standard Linux locations
search_paths.push_back("/usr/local/bin/hush-arrakis-chain");
search_paths.push_back("/usr/bin/hush-arrakis-chain");
search_paths.push_back("/usr/local/bin/dragonxd");
search_paths.push_back("/usr/bin/dragonxd");
// Home directory
const char* home = getenv("HOME");
if (home) {
search_paths.push_back(std::string(home) + "/hush3/src/hush-arrakis-chain");
search_paths.push_back(std::string(home) + "/hush3/src/dragonxd");
search_paths.push_back(std::string(home) + "/bin/hush-arrakis-chain");
search_paths.push_back(std::string(home) + "/dragonx/src/dragonxd");
search_paths.push_back(std::string(home) + "/bin/dragonxd");
}
#ifdef __APPLE__
// macOS app bundle
search_paths.push_back("/Applications/DragonX.app/Contents/MacOS/hush-arrakis-chain");
search_paths.push_back("/Applications/DragonX.app/Contents/MacOS/dragonxd");
#endif
#endif
@@ -403,7 +393,7 @@ bool EmbeddedDaemon::startProcess(const std::string& binary_path, const std::vec
// Launch daemon with CREATE_NEW_CONSOLE (hidden via SW_HIDE).
// The daemon binary must NOT be in the data directory (%APPDATA%\Hush\DRAGONX)
// — it must be in <exe_dir>/hush3/ to avoid conflicts with lock files and data.
// — it must be in <exe_dir>/dragonx/ to avoid conflicts with lock files and data.
STARTUPINFOA si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
@@ -564,7 +554,7 @@ void EmbeddedDaemon::stop(int wait_ms)
};
if (tracked_alive) {
// Our tracked process (hushd.exe launched directly) is still alive.
// Our tracked process (dragonxd.exe launched directly) is still alive.
// The RPC "stop" was already sent by the caller — wait for it to exit.
DEBUG_LOGF("Waiting up to %d ms for tracked daemon process to exit...\n", wait_ms);
if (!pollWait(process_handle_, wait_ms)) {
@@ -577,33 +567,33 @@ void EmbeddedDaemon::stop(int wait_ms)
process_handle_ = nullptr;
} else {
// Tracked handle is dead (batch file case: cmd.exe already exited).
// The real hushd.exe may still be running as an orphan.
// The real dragonxd.exe may still be running as an orphan.
if (process_handle_ != nullptr) {
CloseHandle(process_handle_);
process_handle_ = nullptr;
}
// Find the real hushd.exe process by name
DWORD hushd_pid = findProcessByName("hushd.exe");
if (hushd_pid != 0) {
DEBUG_LOGF("Found orphaned hushd.exe (PID %lu) — waiting for RPC stop to take effect...\n", hushd_pid);
HANDLE hProc = OpenProcess(PROCESS_TERMINATE | SYNCHRONIZE, FALSE, hushd_pid);
// Find the real dragonxd.exe process by name
DWORD dragonxd_pid = findProcessByName("dragonxd.exe");
if (dragonxd_pid != 0) {
DEBUG_LOGF("Found orphaned dragonxd.exe (PID %lu) — waiting for RPC stop to take effect...\n", dragonxd_pid);
HANDLE hProc = OpenProcess(PROCESS_TERMINATE | SYNCHRONIZE, FALSE, dragonxd_pid);
if (hProc) {
// RPC stop was already sent — wait for graceful exit
if (!pollWait(hProc, wait_ms)) {
DEBUG_LOGF("Timeout — forcing hushd.exe (PID %lu) termination...\n", hushd_pid);
DEBUG_LOGF("Timeout — forcing dragonxd.exe (PID %lu) termination...\n", dragonxd_pid);
TerminateProcess(hProc, 1);
WaitForSingleObject(hProc, 2000);
}
drainOutput();
CloseHandle(hProc);
DEBUG_LOGF("hushd.exe stopped\n");
DEBUG_LOGF("dragonxd.exe stopped\n");
} else {
DEBUG_LOGF("Could not open hushd.exe process (PID %lu), error %lu\n",
hushd_pid, GetLastError());
DEBUG_LOGF("Could not open dragonxd.exe process (PID %lu), error %lu\n",
dragonxd_pid, GetLastError());
}
} else {
DEBUG_LOGF("No hushd.exe process found — daemon may have already exited\n");
DEBUG_LOGF("No dragonxd.exe process found — daemon may have already exited\n");
}
}
@@ -738,11 +728,11 @@ bool EmbeddedDaemon::startProcess(const std::string& binary_path, const std::vec
close(pipefd[0]); // Close read end
// Put child in its own process group so we can kill the entire
// group later (including hushd spawned by a wrapper script).
// Without this, SIGTERM only kills the shell, leaving hushd orphaned.
// group later (including dragonxd spawned by a wrapper script).
// Without this, SIGTERM only kills the shell, leaving dragonxd orphaned.
setpgid(0, 0);
// Change to the daemon binary's directory so hushd can find
// Change to the daemon binary's directory so dragonxd can find
// sapling params via its PWD search path (same as CreateProcessA
// lpCurrentDirectory on Windows).
{
@@ -769,8 +759,7 @@ bool EmbeddedDaemon::startProcess(const std::string& binary_path, const std::vec
bool is_script = false;
if (binary_path.size() >= 3) {
std::string ext = binary_path.substr(binary_path.size() - 3);
if (ext == ".sh" || binary_path.find("hush-arrakis-chain") != std::string::npos ||
binary_path.find("dragonxd") != std::string::npos) {
if (ext == ".sh" || binary_path.find("dragonxd") != std::string::npos) {
// Check if it's a script by looking at first bytes
FILE* f = fopen(binary_path.c_str(), "r");
if (f) {
@@ -828,7 +817,7 @@ double EmbeddedDaemon::getMemoryUsageMB() const
if (process_pid_ <= 0) return 0.0;
// The tracked PID is often a bash wrapper script; the real daemon
// (hushd) is a child in the same process group. Sum VmRSS for every
// (dragonxd) is a child in the same process group. Sum VmRSS for every
// process whose PGID matches our tracked PID.
double total_rss_mb = 0.0;
@@ -919,8 +908,8 @@ void EmbeddedDaemon::stop(int wait_ms)
// Send SIGTERM to the entire process group (negative PID).
// This ensures that if dragonxd is a shell script wrapper,
// both bash AND the actual hushd child receive the signal.
// Without this, only bash is killed and hushd is orphaned.
// both bash AND the actual dragonxd child receive the signal.
// Without this, only bash is killed and dragonxd is orphaned.
DEBUG_LOGF("Sending SIGTERM to process group -%d\n", process_pid_);
kill(-process_pid_, SIGTERM);

View File

@@ -34,11 +34,9 @@ static const EmbeddedResource s_resources[] = {
{ g_sapling_output_params_data, g_sapling_output_params_size, RESOURCE_SAPLING_OUTPUT },
{ g_asmap_dat_data, g_asmap_dat_size, RESOURCE_ASMAP },
#ifdef HAS_EMBEDDED_DAEMON
{ g_hushd_exe_data, g_hushd_exe_size, RESOURCE_HUSHD },
{ g_hush_cli_exe_data, g_hush_cli_exe_size, RESOURCE_HUSH_CLI },
{ g_hush_tx_exe_data, g_hush_tx_exe_size, RESOURCE_HUSH_TX },
{ g_dragonxd_bat_data, g_dragonxd_bat_size, RESOURCE_DRAGONXD_BAT },
{ g_dragonx_cli_bat_data, g_dragonx_cli_bat_size, RESOURCE_DRAGONX_CLI_BAT },
{ g_dragonxd_exe_data, g_dragonxd_exe_size, RESOURCE_DRAGONXD },
{ g_dragonx_cli_exe_data, g_dragonx_cli_exe_size, RESOURCE_DRAGONX_CLI },
{ g_dragonx_tx_exe_data, g_dragonx_tx_exe_size, RESOURCE_DRAGONX_TX },
#endif
#ifdef HAS_EMBEDDED_XMRIG
{ g_xmrig_exe_data, g_xmrig_exe_size, RESOURCE_XMRIG },
@@ -177,7 +175,7 @@ bool needsParamsExtraction()
return false;
}
// Check daemon directory (hush3/) — the only extraction target
// Check daemon directory (dragonx/) — the only extraction target
std::string daemonDir = getDaemonDirectory();
std::string spendPath = daemonDir +
#ifdef _WIN32
@@ -246,10 +244,10 @@ bool extractEmbeddedResources()
const char pathSep = '/';
#endif
// All files go to <ObsidianDragonDir>/hush3/
// All files go to <ObsidianDragonDir>/dragonx/
std::string daemonDir = getDaemonDirectory();
// Extract Sapling params to daemon directory alongside hushd
// Extract Sapling params to daemon directory alongside dragonxd
const EmbeddedResource* spendRes = getEmbeddedResource(RESOURCE_SAPLING_SPEND);
if (spendRes) {
std::string dest = daemonDir + pathSep + RESOURCE_SAPLING_SPEND;
@@ -285,65 +283,43 @@ bool extractEmbeddedResources()
}
// Extract daemon binaries — NOT the data directory.
// Running hushd.exe from inside the data directory (where it writes blockchain
// Running dragonxd.exe from inside the data directory (where it writes blockchain
// data, debug.log, lock files, etc.) causes crashes on some Windows machines.
#ifdef HAS_EMBEDDED_DAEMON
DEBUG_LOGF("[INFO] Daemon extraction directory: %s\n", daemonDir.c_str());
const EmbeddedResource* hushdRes = getEmbeddedResource(RESOURCE_HUSHD);
if (hushdRes) {
std::string dest = daemonDir + pathSep + RESOURCE_HUSHD;
const EmbeddedResource* daemonRes = getEmbeddedResource(RESOURCE_DRAGONXD);
if (daemonRes) {
std::string dest = daemonDir + pathSep + RESOURCE_DRAGONXD;
if (!std::filesystem::exists(dest)) {
DEBUG_LOGF("[INFO] Extracting hushd.exe (%zu MB)...\n", hushdRes->size / (1024*1024));
if (!extractResource(hushdRes, dest)) {
DEBUG_LOGF("[INFO] Extracting dragonxd.exe (%zu MB)...\n", daemonRes->size / (1024*1024));
if (!extractResource(daemonRes, dest)) {
success = false;
}
}
}
const EmbeddedResource* cliRes = getEmbeddedResource(RESOURCE_HUSH_CLI);
const EmbeddedResource* cliRes = getEmbeddedResource(RESOURCE_DRAGONX_CLI);
if (cliRes) {
std::string dest = daemonDir + pathSep + RESOURCE_HUSH_CLI;
std::string dest = daemonDir + pathSep + RESOURCE_DRAGONX_CLI;
if (!std::filesystem::exists(dest)) {
DEBUG_LOGF("[INFO] Extracting hush-cli.exe (%zu MB)...\n", cliRes->size / (1024*1024));
DEBUG_LOGF("[INFO] Extracting dragonx-cli.exe (%zu MB)...\n", cliRes->size / (1024*1024));
if (!extractResource(cliRes, dest)) {
success = false;
}
}
}
const EmbeddedResource* batRes = getEmbeddedResource(RESOURCE_DRAGONXD_BAT);
if (batRes) {
std::string dest = daemonDir + pathSep + RESOURCE_DRAGONXD_BAT;
if (!std::filesystem::exists(dest)) {
DEBUG_LOGF("[INFO] Extracting dragonxd.bat...\n");
if (!extractResource(batRes, dest)) {
success = false;
}
}
}
const EmbeddedResource* txRes = getEmbeddedResource(RESOURCE_HUSH_TX);
const EmbeddedResource* txRes = getEmbeddedResource(RESOURCE_DRAGONX_TX);
if (txRes) {
std::string dest = daemonDir + pathSep + RESOURCE_HUSH_TX;
std::string dest = daemonDir + pathSep + RESOURCE_DRAGONX_TX;
if (!std::filesystem::exists(dest)) {
DEBUG_LOGF("[INFO] Extracting hush-tx.exe (%zu MB)...\n", txRes->size / (1024*1024));
DEBUG_LOGF("[INFO] Extracting dragonx-tx.exe (%zu MB)...\n", txRes->size / (1024*1024));
if (!extractResource(txRes, dest)) {
success = false;
}
}
}
const EmbeddedResource* cliBatRes = getEmbeddedResource(RESOURCE_DRAGONX_CLI_BAT);
if (cliBatRes) {
std::string dest = daemonDir + pathSep + RESOURCE_DRAGONX_CLI_BAT;
if (!std::filesystem::exists(dest)) {
DEBUG_LOGF("[INFO] Extracting dragonx-cli.bat...\n");
if (!extractResource(cliBatRes, dest)) {
success = false;
}
}
}
#endif
#ifdef HAS_EMBEDDED_XMRIG
@@ -364,14 +340,14 @@ bool extractEmbeddedResources()
std::string getDaemonDirectory()
{
// Daemon binaries live in %APPDATA%/ObsidianDragon/hush3/ (Windows) or
// ~/.config/ObsidianDragon/hush3/ (Linux) — separate from the blockchain
// Daemon binaries live in %APPDATA%/ObsidianDragon/dragonx/ (Windows) or
// ~/.config/ObsidianDragon/dragonx/ (Linux) — separate from the blockchain
// data directory to avoid lock-file conflicts.
std::string obsidianDir = util::Platform::getObsidianDragonDir();
#ifdef _WIN32
return obsidianDir + "\\hush3";
return obsidianDir + "\\dragonx";
#else
return obsidianDir + "/hush3";
return obsidianDir + "/dragonx";
#endif
}
@@ -380,11 +356,11 @@ bool needsDaemonExtraction()
#ifdef HAS_EMBEDDED_DAEMON
std::string daemonDir = getDaemonDirectory();
#ifdef _WIN32
std::string hushdPath = daemonDir + "\\hushd.exe";
std::string daemonPath = daemonDir + "\\dragonxd.exe";
#else
std::string hushdPath = daemonDir + "/hushd";
std::string daemonPath = daemonDir + "/dragonxd";
#endif
return !std::filesystem::exists(hushdPath);
return !std::filesystem::exists(daemonPath);
#else
return false;
#endif
@@ -397,9 +373,9 @@ bool hasDaemonAvailable()
#else
// Check if daemon exists alongside the executable
#ifdef _WIN32
return std::filesystem::exists("hushd.exe") || std::filesystem::exists("dragonxd.bat");
return std::filesystem::exists("dragonxd.exe");
#else
return std::filesystem::exists("hushd") || std::filesystem::exists("dragonxd");
return std::filesystem::exists("dragonxd");
#endif
#endif
}
@@ -409,10 +385,10 @@ std::string getDaemonPath()
std::string daemonDir = getDaemonDirectory();
#ifdef _WIN32
const char pathSep = '\\';
const char* daemonName = "hushd.exe";
const char* daemonName = "dragonxd.exe";
#else
const char pathSep = '/';
const char* daemonName = "hushd";
const char* daemonName = "dragonxd";
#endif
DEBUG_LOGF("[DEBUG] getDaemonPath: daemonDir=%s\n", daemonDir.c_str());

View File

@@ -34,11 +34,9 @@ std::string getParamsDirectory();
constexpr const char* RESOURCE_SAPLING_SPEND = "sapling-spend.params";
constexpr const char* RESOURCE_SAPLING_OUTPUT = "sapling-output.params";
constexpr const char* RESOURCE_ASMAP = "asmap.dat";
constexpr const char* RESOURCE_HUSHD = "hushd.exe";
constexpr const char* RESOURCE_HUSH_CLI = "hush-cli.exe";
constexpr const char* RESOURCE_HUSH_TX = "hush-tx.exe";
constexpr const char* RESOURCE_DRAGONXD_BAT = "dragonxd.bat";
constexpr const char* RESOURCE_DRAGONX_CLI_BAT = "dragonx-cli.bat";
constexpr const char* RESOURCE_DRAGONXD = "dragonxd.exe";
constexpr const char* RESOURCE_DRAGONX_CLI = "dragonx-cli.exe";
constexpr const char* RESOURCE_DRAGONX_TX = "dragonx-tx.exe";
constexpr const char* RESOURCE_XMRIG = "xmrig.exe";
constexpr const char* RESOURCE_DARK_GRADIENT = "dark_gradient.png";
constexpr const char* RESOURCE_LOGO = "logo_ObsidianDragon_dark.png";
@@ -60,7 +58,7 @@ int extractBundledThemes(const std::string& destDir);
// Check if daemon needs to be extracted
bool needsDaemonExtraction();
// Get daemon binary directory (<exe_dir>/hush3/)
// Get daemon binary directory (<exe_dir>/dragonx/)
std::string getDaemonDirectory();
// Check if daemon is available (embedded or in app directory)

View File

@@ -63,7 +63,7 @@ std::string Connection::getDefaultConfPath()
std::string Connection::getSaplingParamsDir()
{
// Sapling params are now extracted alongside the daemon binaries
// in <ObsidianDragonDir>/hush3/ — no longer in the legacy ZcashParams dir.
// in <ObsidianDragonDir>/dragonx/ — no longer in the legacy ZcashParams dir.
return resources::getDaemonDirectory();
}

View File

@@ -1688,7 +1688,7 @@ void RenderSettingsPage(App* app) {
"Changes take effect after restarting the daemon.");
ImGui::Dummy(ImVec2(0, Layout::spacingSm()));
// The 22 hushd debug categories
// The 22 dragonxd debug categories
static const char* debugCats[] = {
"addrman", "alert", "bench", "coindb", "db", "estimatefee",
"http", "libevent", "lock", "mempool", "net",

View File

@@ -442,7 +442,7 @@ void RenderMiningTab(App* app)
dl->AddText(sub1, sub1->LegacySize, countPos, OnSurface(), buf);
// RAM estimate inline (after thread count)
// Model matches hush3 RandomX: shared ~2080MB dataset + ~256MB cache (allocated once),
// Model matches DragonX RandomX: shared ~2080MB dataset + ~256MB cache (allocated once),
// plus ~2MB scratchpad per mining thread VM.
{
float countW = sub1->CalcTextSizeA(sub1->LegacySize, FLT_MAX, 0, buf).x;

View File

@@ -486,7 +486,7 @@ double Platform::getSelfMemoryUsageMB()
double Platform::getDaemonMemoryUsageMB()
{
#ifdef _WIN32
// Windows: use CreateToolhelp32Snapshot to find hushd.exe processes
// Windows: use CreateToolhelp32Snapshot to find dragonxd.exe processes
// and query their working set size.
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snap == INVALID_HANDLE_VALUE) return 0.0;
@@ -497,7 +497,7 @@ double Platform::getDaemonMemoryUsageMB()
double totalMB = 0.0;
if (Process32First(snap, &entry)) {
do {
if (_stricmp(entry.szExeFile, "hushd.exe") == 0) {
if (_stricmp(entry.szExeFile, "dragonxd.exe") == 0) {
// GetProcessMemoryInfo requires PROCESS_QUERY_INFORMATION + PROCESS_VM_READ.
// Try full access first; fall back to limited for elevated processes.
HANDLE hProc = OpenProcess(
@@ -522,8 +522,8 @@ double Platform::getDaemonMemoryUsageMB()
CloseHandle(snap);
return totalMB;
#elif defined(__APPLE__)
// macOS: use pgrep to find hushd PIDs, then read RSS via proc_pidinfo
FILE* fp = popen("pgrep -x hushd", "r");
// macOS: use pgrep to find dragonxd PIDs, then read RSS via proc_pidinfo
FILE* fp = popen("pgrep -x dragonxd", "r");
if (!fp) return 0.0;
double totalMB = 0.0;
char line[64];
@@ -548,7 +548,7 @@ double Platform::getDaemonMemoryUsageMB()
pclose(fp);
return totalMB;
#else
// Linux: iterate /proc/<pid>/comm looking for "hushd"
// Linux: iterate /proc/<pid>/comm looking for "dragonxd"
DIR* procDir = opendir("/proc");
if (!procDir) return 0.0;
double totalMB = 0.0;
@@ -573,7 +573,7 @@ double Platform::getDaemonMemoryUsageMB()
}
fclose(cf);
if (strcmp(comm, "hushd") != 0) continue;
if (strcmp(comm, "dragonxd") != 0) continue;
// Read VmRSS from /proc/<pid>/status
char statusPath[64];

View File

@@ -118,8 +118,8 @@ public:
static double getSelfMemoryUsageMB();
/**
* @brief Get total RSS of all hushd daemon processes in megabytes
* Scans for any running hushd process by name, regardless of how it was launched.
* @brief Get total RSS of all dragonxd daemon processes in megabytes
* Scans for any running dragonxd process by name, regardless of how it was launched.
* @return Combined daemon RSS in MB, or 0 if no daemon found
*/
static double getDaemonMemoryUsageMB();