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:
12
README.md
12
README.md
@@ -33,10 +33,10 @@ A lightweight, portable cryptocurrency wallet for DragonX (DRGX), built with Dea
|
||||
The setup script detects your OS, installs all build dependencies, and validates your environment:
|
||||
|
||||
```bash
|
||||
./scripts/setup.sh # Install core build deps (interactive)
|
||||
./scripts/setup.sh --check # Just report what's missing
|
||||
./scripts/setup.sh --all # Core + Windows/macOS cross-compile + Sapling params
|
||||
./scripts/setup.sh --win # Also install mingw-w64 + libsodium-win
|
||||
./setup.sh # Install core build deps (interactive)
|
||||
./setup.sh --check # Just report what's missing
|
||||
./setup.sh --all # Core + Windows/macOS cross-compile + Sapling params
|
||||
./setup.sh --win # Also install mingw-w64 + libsodium-win
|
||||
```
|
||||
|
||||
### Manual Prerequisites
|
||||
@@ -71,7 +71,7 @@ brew install cmake
|
||||
### Binaries
|
||||
Download linux and windows binaries of latest releases and place in binary directories:
|
||||
|
||||
**DragonX daemon** (https://git.dragonx.is/dragonx/hush3):
|
||||
**DragonX daemon** (https://git.dragonx.is/DragonX/dragonx):
|
||||
- prebuilt-binaries/dragonxd-linux/
|
||||
- prebuilt-binaries/dragonxd-win/
|
||||
- prebuilt-binaries/dragonxd-mac/
|
||||
@@ -128,7 +128,7 @@ The wallet checks its **own directory first** when looking for DragonX node bina
|
||||
**Search order:**
|
||||
1. Wallet executable directory (highest priority)
|
||||
2. Embedded/extracted daemon (app data directory)
|
||||
3. System-wide locations (`/usr/local/bin`, `~/hush3/src`, etc.)
|
||||
3. System-wide locations (`/usr/local/bin`, `~/dragonx/src`, etc.)
|
||||
|
||||
This is useful for testing new branches or hotfixes to the node software before they are bundled into a wallet release.
|
||||
## Configuration
|
||||
|
||||
78
build.sh
78
build.sh
@@ -122,10 +122,10 @@ find_sapling_params() {
|
||||
|
||||
find_asmap() {
|
||||
local paths=(
|
||||
"$SCRIPT_DIR/external/hush3/asmap.dat"
|
||||
"$SCRIPT_DIR/external/hush3/contrib/asmap/asmap.dat"
|
||||
"$HOME/hush3/asmap.dat"
|
||||
"$HOME/hush3/contrib/asmap/asmap.dat"
|
||||
"$SCRIPT_DIR/external/dragonx/asmap.dat"
|
||||
"$SCRIPT_DIR/external/dragonx/contrib/asmap/asmap.dat"
|
||||
"$HOME/dragonx/asmap.dat"
|
||||
"$HOME/dragonx/contrib/asmap/asmap.dat"
|
||||
"$SCRIPT_DIR/../asmap.dat"
|
||||
"$SCRIPT_DIR/asmap.dat"
|
||||
"$SCRIPT_DIR/../SilentDragonX/asmap.dat"
|
||||
@@ -147,37 +147,37 @@ bundle_linux_daemon() {
|
||||
local dest="$1"
|
||||
local found=0
|
||||
|
||||
local launcher_paths=(
|
||||
"$SCRIPT_DIR/prebuilt-binaries/dragonxd-linux/hush-arrakis-chain"
|
||||
"$SCRIPT_DIR/../hush-arrakis-chain"
|
||||
"$SCRIPT_DIR/external/hush3/src/hush-arrakis-chain"
|
||||
"$HOME/hush3/src/hush-arrakis-chain"
|
||||
local daemon_paths=(
|
||||
"$SCRIPT_DIR/prebuilt-binaries/dragonxd-linux/dragonxd"
|
||||
"$SCRIPT_DIR/../dragonxd"
|
||||
"$SCRIPT_DIR/external/dragonx/src/dragonxd"
|
||||
"$HOME/dragonx/src/dragonxd"
|
||||
)
|
||||
for p in "${launcher_paths[@]}"; do
|
||||
for p in "${daemon_paths[@]}"; do
|
||||
if [[ -f "$p" ]]; then
|
||||
cp "$p" "$dest/hush-arrakis-chain"; chmod +x "$dest/hush-arrakis-chain"
|
||||
info " Bundled hush-arrakis-chain"; found=1; break
|
||||
cp "$p" "$dest/dragonxd"; chmod +x "$dest/dragonxd"
|
||||
info " Bundled dragonxd"; found=1; break
|
||||
fi
|
||||
done
|
||||
|
||||
local hushd_paths=(
|
||||
"$SCRIPT_DIR/prebuilt-binaries/dragonxd-linux/hushd"
|
||||
"$SCRIPT_DIR/../hushd"
|
||||
"$SCRIPT_DIR/external/hush3/src/hushd"
|
||||
"$HOME/hush3/src/hushd"
|
||||
local cli_paths=(
|
||||
"$SCRIPT_DIR/prebuilt-binaries/dragonxd-linux/dragonx-cli"
|
||||
"$SCRIPT_DIR/../dragonx-cli"
|
||||
"$SCRIPT_DIR/external/dragonx/src/dragonx-cli"
|
||||
"$HOME/dragonx/src/dragonx-cli"
|
||||
)
|
||||
for p in "${hushd_paths[@]}"; do
|
||||
for p in "${cli_paths[@]}"; do
|
||||
if [[ -f "$p" ]]; then
|
||||
cp "$p" "$dest/hushd"; chmod +x "$dest/hushd"
|
||||
info " Bundled hushd"; break
|
||||
cp "$p" "$dest/dragonx-cli"; chmod +x "$dest/dragonx-cli"
|
||||
info " Bundled dragonx-cli"; break
|
||||
fi
|
||||
done
|
||||
|
||||
local dragonxd_paths=(
|
||||
"$SCRIPT_DIR/prebuilt-binaries/dragonxd-linux/dragonxd"
|
||||
"$SCRIPT_DIR/../dragonxd"
|
||||
"$SCRIPT_DIR/external/hush3/src/dragonxd"
|
||||
"$HOME/hush3/src/dragonxd"
|
||||
"$SCRIPT_DIR/external/dragonx/src/dragonxd"
|
||||
"$HOME/dragonx/src/dragonxd"
|
||||
)
|
||||
for p in "${dragonxd_paths[@]}"; do
|
||||
if [[ -f "$p" ]]; then
|
||||
@@ -254,9 +254,8 @@ build_release_linux() {
|
||||
mkdir -p "$out"
|
||||
|
||||
cp bin/ObsidianDragon "$out/"
|
||||
[[ -f bin/hush-arrakis-chain ]] && cp bin/hush-arrakis-chain "$out/"
|
||||
[[ -f bin/hushd ]] && cp bin/hushd "$out/"
|
||||
[[ -f bin/dragonxd ]] && cp bin/dragonxd "$out/"
|
||||
[[ -f bin/dragonx-cli ]] && cp bin/dragonx-cli "$out/"
|
||||
[[ -f bin/asmap.dat ]] && cp bin/asmap.dat "$out/"
|
||||
cp -r bin/res "$out/" 2>/dev/null || true
|
||||
|
||||
@@ -273,9 +272,8 @@ build_release_linux() {
|
||||
cp -r bin/res/* "$APPDIR/usr/share/ObsidianDragon/res/" 2>/dev/null || true
|
||||
|
||||
# Daemon inside AppImage
|
||||
[[ -f bin/hush-arrakis-chain ]] && cp bin/hush-arrakis-chain "$APPDIR/usr/bin/"
|
||||
[[ -f bin/hushd ]] && cp bin/hushd "$APPDIR/usr/bin/"
|
||||
[[ -f bin/dragonxd ]] && cp bin/dragonxd "$APPDIR/usr/bin/"
|
||||
[[ -f bin/dragonx-cli ]] && cp bin/dragonx-cli "$APPDIR/usr/bin/"
|
||||
[[ -f bin/asmap.dat ]] && cp bin/asmap.dat "$APPDIR/usr/share/ObsidianDragon/"
|
||||
|
||||
# Desktop entry
|
||||
@@ -467,10 +465,10 @@ HDR
|
||||
|
||||
# ── Daemon binaries ──────────────────────────────────────────────
|
||||
local DD="$SCRIPT_DIR/prebuilt-binaries/dragonxd-win"
|
||||
if [[ -d "$DD" && -f "$DD/hushd.exe" ]]; then
|
||||
if [[ -d "$DD" && -f "$DD/dragonxd.exe" ]]; then
|
||||
info "Embedding daemon binaries ..."
|
||||
echo -e "\n#define HAS_EMBEDDED_DAEMON 1\n" >> "$GEN/embedded_data.h"
|
||||
for f in hushd.exe hush-cli.exe hush-tx.exe dragonxd.bat dragonx-cli.bat; do
|
||||
for f in dragonxd.exe dragonx-cli.exe dragonx-tx.exe; do
|
||||
local sym=$(echo "$f" | sed 's/[^a-zA-Z0-9]/_/g')
|
||||
if [[ -f "$DD/$f" ]]; then
|
||||
cp -f "$DD/$f" "$RES/$f"
|
||||
@@ -583,7 +581,7 @@ HDR
|
||||
cp bin/ObsidianDragon.exe "$dist_dir/"
|
||||
|
||||
local DD="$SCRIPT_DIR/prebuilt-binaries/dragonxd-win"
|
||||
for f in dragonxd.bat dragonx-cli.bat hushd.exe hush-cli.exe hush-tx.exe; do
|
||||
for f in dragonxd.exe dragonx-cli.exe dragonx-tx.exe; do
|
||||
[[ -f "$DD/$f" ]] && cp "$DD/$f" "$dist_dir/"
|
||||
done
|
||||
|
||||
@@ -836,24 +834,24 @@ TOOLCHAIN
|
||||
# Daemon binaries (macOS native, from dragonxd-mac/)
|
||||
local daemon_dir="$SCRIPT_DIR/prebuilt-binaries/dragonxd-mac"
|
||||
if [[ -d "$daemon_dir" ]]; then
|
||||
for f in hush-arrakis-chain hushd hush-cli hush-tx dragonxd; do
|
||||
for f in dragonxd dragonx-cli dragonx-tx; do
|
||||
[[ -f "$daemon_dir/$f" ]] && { cp "$daemon_dir/$f" "$MACOS/"; chmod +x "$MACOS/$f"; info " Bundled $f"; }
|
||||
done
|
||||
elif ! $IS_CROSS; then
|
||||
# Native macOS: try standard paths
|
||||
local launcher_paths=(
|
||||
"$SCRIPT_DIR/../hush-arrakis-chain"
|
||||
"$HOME/hush3/src/hush-arrakis-chain"
|
||||
local daemon_paths=(
|
||||
"$SCRIPT_DIR/../dragonxd"
|
||||
"$HOME/dragonx/src/dragonxd"
|
||||
)
|
||||
for p in "${launcher_paths[@]}"; do
|
||||
[[ -f "$p" ]] && { cp "$p" "$MACOS/hush-arrakis-chain"; chmod +x "$MACOS/hush-arrakis-chain"; info " Bundled hush-arrakis-chain"; break; }
|
||||
for p in "${daemon_paths[@]}"; do
|
||||
[[ -f "$p" ]] && { cp "$p" "$MACOS/dragonxd"; chmod +x "$MACOS/dragonxd"; info " Bundled dragonxd"; break; }
|
||||
done
|
||||
local hushd_paths=(
|
||||
"$SCRIPT_DIR/../hushd"
|
||||
"$HOME/hush3/src/hushd"
|
||||
local cli_paths=(
|
||||
"$SCRIPT_DIR/../dragonx-cli"
|
||||
"$HOME/dragonx/src/dragonx-cli"
|
||||
)
|
||||
for p in "${hushd_paths[@]}"; do
|
||||
[[ -f "$p" ]] && { cp "$p" "$MACOS/hushd"; chmod +x "$MACOS/hushd"; info " Bundled hushd"; break; }
|
||||
for p in "${cli_paths[@]}"; do
|
||||
[[ -f "$p" ]] && { cp "$p" "$MACOS/dragonx-cli"; chmod +x "$MACOS/dragonx-cli"; info " Bundled dragonx-cli"; break; }
|
||||
done
|
||||
else
|
||||
warn "prebuilt-binaries/dragonxd-mac/ not found — place macOS daemon binaries there for bundling"
|
||||
|
||||
@@ -137,7 +137,7 @@ if [ -f "bin/ObsidianDragon" ]; then
|
||||
"${SCRIPT_DIR}/prebuilt-binaries/dragonxd-linux/hush-arrakis-chain"
|
||||
"${SCRIPT_DIR}/../hush-arrakis-chain"
|
||||
"${SCRIPT_DIR}/hush-arrakis-chain"
|
||||
"$HOME/hush3/src/hush-arrakis-chain"
|
||||
"$HOME/dragonx/src/hush-arrakis-chain"
|
||||
)
|
||||
|
||||
for lpath in "${LAUNCHER_PATHS[@]}"; do
|
||||
@@ -155,7 +155,7 @@ if [ -f "bin/ObsidianDragon" ]; then
|
||||
"${SCRIPT_DIR}/prebuilt-binaries/dragonxd-linux/hushd"
|
||||
"${SCRIPT_DIR}/../hushd"
|
||||
"${SCRIPT_DIR}/hushd"
|
||||
"$HOME/hush3/src/hushd"
|
||||
"$HOME/dragonx/src/hushd"
|
||||
)
|
||||
|
||||
for hpath in "${HUSHD_PATHS[@]}"; do
|
||||
@@ -172,7 +172,7 @@ if [ -f "bin/ObsidianDragon" ]; then
|
||||
"${SCRIPT_DIR}/prebuilt-binaries/dragonxd-linux/dragonxd"
|
||||
"${SCRIPT_DIR}/../dragonxd"
|
||||
"${SCRIPT_DIR}/dragonxd"
|
||||
"$HOME/hush3/src/dragonxd"
|
||||
"$HOME/dragonx/src/dragonxd"
|
||||
)
|
||||
|
||||
for dpath in "${DRAGONXD_PATHS[@]}"; do
|
||||
@@ -189,8 +189,8 @@ if [ -f "bin/ObsidianDragon" ]; then
|
||||
"${SCRIPT_DIR}/prebuilt-binaries/dragonxd-linux/asmap.dat"
|
||||
"${SCRIPT_DIR}/../asmap.dat"
|
||||
"${SCRIPT_DIR}/asmap.dat"
|
||||
"$HOME/hush3/asmap.dat"
|
||||
"$HOME/hush3/contrib/asmap/asmap.dat"
|
||||
"$HOME/dragonx/asmap.dat"
|
||||
"$HOME/dragonx/contrib/asmap/asmap.dat"
|
||||
)
|
||||
|
||||
for apath in "${ASMAP_PATHS[@]}"; do
|
||||
|
||||
@@ -130,8 +130,8 @@ done
|
||||
|
||||
# Look for asmap.dat
|
||||
ASMAP_PATHS=(
|
||||
"$HOME/hush3/asmap.dat"
|
||||
"$HOME/hush3/contrib/asmap/asmap.dat"
|
||||
"$HOME/dragonx/asmap.dat"
|
||||
"$HOME/dragonx/contrib/asmap/asmap.dat"
|
||||
"$SCRIPT_DIR/../asmap.dat"
|
||||
"$SCRIPT_DIR/asmap.dat"
|
||||
"$SCRIPT_DIR/../SilentDragonX/asmap.dat"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# ── scripts/setup.sh ────────────────────────────────────────────────────────
|
||||
# ── setup.sh ────────────────────────────────────────────────────────────────
|
||||
# DragonX Wallet — Development Environment Setup
|
||||
# Copyright 2024-2026 The Hush Developers
|
||||
# Released under the GPLv3
|
||||
@@ -12,17 +12,21 @@
|
||||
# ./build.sh --linux-release # Linux release + AppImage
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/setup.sh # Interactive — install everything needed
|
||||
# ./scripts/setup.sh --check # Just report what's missing, don't install
|
||||
# ./scripts/setup.sh --all # Install dev + all cross-compile targets
|
||||
# ./scripts/setup.sh --win # Also install Windows cross-compile deps
|
||||
# ./scripts/setup.sh --mac # Also install macOS cross-compile deps
|
||||
# ./scripts/setup.sh --sapling # Also download Sapling params (~51 MB)
|
||||
# ./setup.sh # Interactive — install everything needed
|
||||
# ./setup.sh --check # Just report what's missing, don't install
|
||||
# ./setup.sh --all # Install dev + all cross-compile targets
|
||||
# ./setup.sh --win # Also install Windows cross-compile deps
|
||||
# ./setup.sh --mac # Also install macOS cross-compile deps
|
||||
# ./setup.sh --sapling # Also download Sapling params (~51 MB)
|
||||
# ./setup.sh -j6 # Use 6 threads for building
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# ── Parallel builds ─────────────────────────────────────────────────────────
|
||||
# Default to 1 core; use -jN to increase (e.g. -j6)
|
||||
NPROC=1
|
||||
|
||||
# ── Colours ──────────────────────────────────────────────────────────────────
|
||||
RED='\033[0;31m'
|
||||
@@ -53,6 +57,7 @@ while [[ $# -gt 0 ]]; do
|
||||
--mac) SETUP_MAC=true; shift ;;
|
||||
--sapling) SETUP_SAPLING=true; shift ;;
|
||||
--all) SETUP_WIN=true; SETUP_MAC=true; SETUP_SAPLING=true; shift ;;
|
||||
-j*) NPROC="${1#-j}"; shift ;;
|
||||
-h|--help)
|
||||
sed -n '2,/^# ─\{10\}/{ /^# ─\{10\}/d; s/^# \?//p; }' "$0"
|
||||
exit 0
|
||||
@@ -61,6 +66,10 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Apply parallel build flag (after arg parsing so -jN override takes effect)
|
||||
# NOTE: We do NOT export MAKEFLAGS globally — that interferes with autotools
|
||||
# builds (dragonx daemon). Instead, -j is passed explicitly where needed.
|
||||
|
||||
# ── Detect OS / distro ──────────────────────────────────────────────────────
|
||||
detect_os() {
|
||||
OS="$(uname -s)"
|
||||
@@ -152,7 +161,20 @@ install_pkgs() {
|
||||
case "$PKG" in
|
||||
apt) sudo apt-get update -qq && sudo apt-get install -y $pkgs ;;
|
||||
dnf) sudo dnf install -y $pkgs ;;
|
||||
pacman) sudo pacman -S --needed --noconfirm $pkgs ;;
|
||||
pacman)
|
||||
# Try pacman first; fall back to AUR helper for packages not in official repos
|
||||
if ! sudo pacman -S --needed --noconfirm $pkgs 2>/dev/null; then
|
||||
if command -v yay &>/dev/null; then
|
||||
yay -S --needed --noconfirm $pkgs
|
||||
elif command -v paru &>/dev/null; then
|
||||
paru -S --needed --noconfirm $pkgs
|
||||
else
|
||||
err "pacman failed and no AUR helper (yay/paru) found"
|
||||
echo "Some packages may be in the AUR. Install yay or paru, then retry."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
zypper) sudo zypper install -y $pkgs ;;
|
||||
brew) brew install $pkgs ;;
|
||||
*) err "No supported package manager found for $DISTRO"
|
||||
@@ -251,7 +273,7 @@ else
|
||||
miss "libsodium not found"
|
||||
if ! $CHECK_ONLY; then
|
||||
info "Building libsodium from source..."
|
||||
"$SCRIPT_DIR/fetch-libsodium.sh" && SODIUM_OK=true
|
||||
"$PROJECT_DIR/scripts/fetch-libsodium.sh" && SODIUM_OK=true
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -278,7 +300,7 @@ if $SETUP_WIN; then
|
||||
if [[ ! -f "$PROJECT_DIR/libs/libsodium-win/lib/libsodium.a" ]]; then
|
||||
if ! $CHECK_ONLY; then
|
||||
info "Building libsodium for Windows target..."
|
||||
"$SCRIPT_DIR/fetch-libsodium.sh" --win
|
||||
"$PROJECT_DIR/scripts/fetch-libsodium.sh" --win
|
||||
else
|
||||
miss "libsodium-win (not built yet)"
|
||||
fi
|
||||
@@ -312,7 +334,7 @@ if $SETUP_MAC; then
|
||||
# Requires osxcross — skip gracefully if not available
|
||||
if [[ -d "$PROJECT_DIR/external/osxcross/target" ]] || [[ -d "${OSXCROSS:-}/target" ]]; then
|
||||
info "Building libsodium for macOS target..."
|
||||
"$SCRIPT_DIR/fetch-libsodium.sh" --mac || warn "libsodium-mac build failed"
|
||||
"$PROJECT_DIR/scripts/fetch-libsodium.sh" --mac || warn "libsodium-mac build failed"
|
||||
else
|
||||
skip "libsodium-mac (requires osxcross — see README)"
|
||||
fi
|
||||
@@ -376,12 +398,239 @@ else
|
||||
skip "Sapling params not found (use --sapling to download, or they'll be extracted at runtime from embedded builds)"
|
||||
fi
|
||||
|
||||
# ── 6. xmrig-hac (mining binary) ────────────────────────────────────────────
|
||||
# ── 6. DragonX daemon ────────────────────────────────────────────────────────
|
||||
header "DragonX Daemon"
|
||||
|
||||
DRAGONX_SRC="$PROJECT_DIR/external/dragonx"
|
||||
DRAGONXD_LINUX="$PROJECT_DIR/prebuilt-binaries/dragonxd-linux"
|
||||
DRAGONXD_WIN="$PROJECT_DIR/prebuilt-binaries/dragonxd-win"
|
||||
DRAGONXD_MAC="$PROJECT_DIR/prebuilt-binaries/dragonxd-mac"
|
||||
|
||||
DAEMON_BINS="dragonxd dragonx-cli dragonx-tx hushd hush-arrakis-chain hush-cli hush-tx"
|
||||
DAEMON_DATA="asmap.dat sapling-spend.params sapling-output.params"
|
||||
|
||||
# Helper: clone / update dragonx source
|
||||
clone_dragonx_if_needed() {
|
||||
if [[ ! -d "$DRAGONX_SRC" ]]; then
|
||||
info "Cloning dragonx..."
|
||||
git clone https://git.dragonx.is/DragonX/dragonx.git "$DRAGONX_SRC"
|
||||
else
|
||||
ok "dragonx source already present"
|
||||
info "Pulling latest dragonx..."
|
||||
(cd "$DRAGONX_SRC" && git pull --ff-only 2>/dev/null || true)
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper: copy data files (asmap, sapling params) into a destination dir
|
||||
copy_daemon_data() {
|
||||
local dest="$1"
|
||||
for p in "$DRAGONX_SRC/asmap.dat" "$DRAGONX_SRC/contrib/asmap/asmap.dat"; do
|
||||
if [[ -f "$p" ]]; then
|
||||
cp "$p" "$dest/asmap.dat"
|
||||
ok " Installed asmap.dat"
|
||||
break
|
||||
fi
|
||||
done
|
||||
for p in sapling-spend.params sapling-output.params; do
|
||||
if [[ -f "$DRAGONX_SRC/$p" ]]; then
|
||||
cp "$DRAGONX_SRC/$p" "$dest/"
|
||||
ok " Installed $p"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# ── Linux daemon ─────────────────────────────────────────────────────────────
|
||||
|
||||
# Skip Linux daemon build if only cross-compile targets were requested
|
||||
# and we already have Linux binaries (avoids contaminating the build tree)
|
||||
SKIP_LINUX_DAEMON=false
|
||||
if ($SETUP_WIN || $SETUP_MAC) && [[ -f "$DRAGONXD_LINUX/dragonxd" || -f "$DRAGONXD_LINUX/hushd" ]]; then
|
||||
SKIP_LINUX_DAEMON=true
|
||||
fi
|
||||
|
||||
# Clean previous prebuilt daemon binaries so we always rebuild
|
||||
if ! $CHECK_ONLY && ! $SKIP_LINUX_DAEMON; then
|
||||
for f in $DAEMON_BINS $DAEMON_DATA; do
|
||||
rm -f "$DRAGONXD_LINUX/$f" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
|
||||
if $CHECK_ONLY; then
|
||||
if [[ -f "$DRAGONXD_LINUX/dragonxd" ]] || [[ -f "$DRAGONXD_LINUX/hushd" ]]; then
|
||||
ok "dragonxd daemon (Linux) present"
|
||||
else
|
||||
miss "dragonxd daemon (Linux) not built"
|
||||
fi
|
||||
elif $SKIP_LINUX_DAEMON; then
|
||||
skip "dragonxd (Linux) — skipped, binaries already present (cross-compile only)"
|
||||
else
|
||||
clone_dragonx_if_needed
|
||||
|
||||
info "Building dragonx daemon for Linux (this may take a while)..."
|
||||
(
|
||||
cd "$DRAGONX_SRC"
|
||||
bash build.sh -j"$NPROC"
|
||||
)
|
||||
|
||||
# Copy binaries to prebuilt-binaries
|
||||
mkdir -p "$DRAGONXD_LINUX"
|
||||
local_found=0
|
||||
for f in dragonxd dragonx-cli dragonx-tx hushd hush-arrakis-chain hush-cli hush-tx; do
|
||||
if [[ -f "$DRAGONX_SRC/src/$f" ]]; then
|
||||
cp "$DRAGONX_SRC/src/$f" "$DRAGONXD_LINUX/"
|
||||
chmod +x "$DRAGONXD_LINUX/$f"
|
||||
ok " Installed $f"
|
||||
local_found=1
|
||||
fi
|
||||
done
|
||||
copy_daemon_data "$DRAGONXD_LINUX"
|
||||
|
||||
if [[ $local_found -eq 0 ]]; then
|
||||
err "DragonX daemon (Linux) build failed — no binaries found"
|
||||
MISSING=$((MISSING + 1))
|
||||
else
|
||||
ok "DragonX daemon built and installed to prebuilt-binaries/dragonxd-linux/"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Windows daemon (cross-compile, only with --win or --all) ─────────────────
|
||||
|
||||
if ! $SETUP_WIN; then
|
||||
skip "dragonxd (Windows) — use --win to cross-compile"
|
||||
elif $CHECK_ONLY; then
|
||||
if [[ -f "$DRAGONXD_WIN/dragonxd.exe" ]] || [[ -f "$DRAGONXD_WIN/hushd.exe" ]]; then
|
||||
ok "dragonxd daemon (Windows) present"
|
||||
else
|
||||
miss "dragonxd daemon (Windows) not built"
|
||||
fi
|
||||
else
|
||||
clone_dragonx_if_needed
|
||||
|
||||
# Clean previous Windows prebuilt binaries
|
||||
if ! $CHECK_ONLY; then
|
||||
rm -f "$DRAGONXD_WIN"/*.exe "$DRAGONXD_WIN"/*.bat 2>/dev/null || true
|
||||
for f in $DAEMON_DATA; do rm -f "$DRAGONXD_WIN/$f" 2>/dev/null || true; done
|
||||
fi
|
||||
|
||||
info "Building dragonx daemon for Windows (cross-compile, this may take a long time)..."
|
||||
(
|
||||
cd "$DRAGONX_SRC"
|
||||
bash build.sh --win-release -j"$NPROC"
|
||||
)
|
||||
|
||||
# Copy binaries from release directory
|
||||
mkdir -p "$DRAGONXD_WIN"
|
||||
local_found=0
|
||||
# Find the release subdirectory (e.g. release/dragonx-1.0.0-win64/)
|
||||
WIN_RELEASE_DIR=$(find "$DRAGONX_SRC/release" -maxdepth 1 -type d -name '*win64*' 2>/dev/null | head -1)
|
||||
for f in dragonxd.exe dragonx-cli.exe dragonx-tx.exe; do
|
||||
if [[ -n "$WIN_RELEASE_DIR" ]] && [[ -f "$WIN_RELEASE_DIR/$f" ]]; then
|
||||
cp "$WIN_RELEASE_DIR/$f" "$DRAGONXD_WIN/"
|
||||
ok " Installed $f"
|
||||
local_found=1
|
||||
elif [[ -f "$DRAGONX_SRC/src/$f" ]]; then
|
||||
cp "$DRAGONX_SRC/src/$f" "$DRAGONXD_WIN/"
|
||||
ok " Installed $f (from src/)"
|
||||
local_found=1
|
||||
fi
|
||||
done
|
||||
# .bat launchers
|
||||
for f in dragonxd.bat dragonx-cli.bat bootstrap-dragonx.bat; do
|
||||
if [[ -n "$WIN_RELEASE_DIR" ]] && [[ -f "$WIN_RELEASE_DIR/$f" ]]; then
|
||||
cp "$WIN_RELEASE_DIR/$f" "$DRAGONXD_WIN/"
|
||||
ok " Installed $f"
|
||||
fi
|
||||
done
|
||||
copy_daemon_data "$DRAGONXD_WIN"
|
||||
|
||||
if [[ $local_found -eq 0 ]]; then
|
||||
err "DragonX daemon (Windows) build failed — no binaries found"
|
||||
MISSING=$((MISSING + 1))
|
||||
else
|
||||
ok "DragonX daemon (Windows) built and installed to prebuilt-binaries/dragonxd-win/"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── macOS daemon (only with --mac or --all) ──────────────────────────────────
|
||||
|
||||
if ! $SETUP_MAC; then
|
||||
skip "dragonxd (macOS) — use --mac to cross-compile"
|
||||
elif $CHECK_ONLY; then
|
||||
if [[ -f "$DRAGONXD_MAC/dragonxd" ]] || [[ -f "$DRAGONXD_MAC/hushd" ]]; then
|
||||
ok "dragonxd daemon (macOS) present"
|
||||
else
|
||||
miss "dragonxd daemon (macOS) not built"
|
||||
fi
|
||||
else
|
||||
clone_dragonx_if_needed
|
||||
|
||||
# Clean previous macOS prebuilt binaries
|
||||
if ! $CHECK_ONLY; then
|
||||
for f in $DAEMON_BINS $DAEMON_DATA; do
|
||||
rm -f "$DRAGONXD_MAC/$f" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
|
||||
# macOS build requires either native macOS or osxcross
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
info "Building dragonx daemon for macOS (native)..."
|
||||
(
|
||||
cd "$DRAGONX_SRC"
|
||||
bash build.sh -j"$NPROC"
|
||||
)
|
||||
else
|
||||
info "Building dragonx daemon for macOS (requires osxcross)..."
|
||||
OSXCROSS=""
|
||||
for d in "$PROJECT_DIR/external/osxcross" "$HOME/osxcross" "/opt/osxcross"; do
|
||||
if [[ -d "$d/target/bin" ]]; then
|
||||
OSXCROSS="$d"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z "$OSXCROSS" ]]; then
|
||||
warn "osxcross not found — skipping macOS daemon build"
|
||||
warn "Install osxcross to external/osxcross to enable macOS cross-compilation"
|
||||
else
|
||||
info "Using osxcross at $OSXCROSS"
|
||||
(
|
||||
cd "$DRAGONX_SRC"
|
||||
export PATH="$OSXCROSS/target/bin:$PATH"
|
||||
bash util/build-mac-cross.sh 2>/dev/null || bash util/build-mac.sh
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Copy binaries
|
||||
mkdir -p "$DRAGONXD_MAC"
|
||||
local_found=0
|
||||
for f in dragonxd dragonx-cli dragonx-tx hushd hush-arrakis-chain hush-cli hush-tx; do
|
||||
if [[ -f "$DRAGONX_SRC/src/$f" ]]; then
|
||||
cp "$DRAGONX_SRC/src/$f" "$DRAGONXD_MAC/"
|
||||
chmod +x "$DRAGONXD_MAC/$f"
|
||||
ok " Installed $f"
|
||||
local_found=1
|
||||
fi
|
||||
done
|
||||
copy_daemon_data "$DRAGONXD_MAC"
|
||||
|
||||
if [[ $local_found -eq 0 ]]; then
|
||||
warn "DragonX daemon (macOS) — no binaries found (osxcross may be missing)"
|
||||
else
|
||||
ok "DragonX daemon (macOS) built and installed to prebuilt-binaries/dragonxd-mac/"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── 7. xmrig-hac (mining binary) ────────────────────────────────────────────
|
||||
header "xmrig-hac Mining Binary"
|
||||
|
||||
XMRIG_SRC="$PROJECT_DIR/external/xmrig-hac"
|
||||
XMRIG_PREBUILT="$PROJECT_DIR/prebuilt-binaries/xmrig-hac"
|
||||
|
||||
# Clean previous prebuilt xmrig binaries so we always rebuild
|
||||
if ! $CHECK_ONLY; then
|
||||
rm -f "$XMRIG_PREBUILT/xmrig" "$XMRIG_PREBUILT/xmrig.exe" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Helper: clone xmrig-hac if not present
|
||||
clone_xmrig_if_needed() {
|
||||
if [[ ! -d "$XMRIG_SRC" ]]; then
|
||||
@@ -395,13 +644,18 @@ clone_xmrig_if_needed() {
|
||||
# ── Linux xmrig ─────────────────────────────────────────────────────────────
|
||||
XMRIG_LINUX="$XMRIG_PREBUILT/xmrig"
|
||||
|
||||
if [[ -f "$XMRIG_LINUX" ]]; then
|
||||
ok "xmrig (Linux) already built ($(du -h "$XMRIG_LINUX" | cut -f1))"
|
||||
elif $CHECK_ONLY; then
|
||||
miss "xmrig (Linux) not built (run setup without --check to build)"
|
||||
if $CHECK_ONLY; then
|
||||
if [[ -f "$XMRIG_LINUX" ]]; then
|
||||
ok "xmrig (Linux) ($(du -h "$XMRIG_LINUX" | cut -f1))"
|
||||
else
|
||||
miss "xmrig (Linux) not built (run setup without --check to build)"
|
||||
fi
|
||||
else
|
||||
clone_xmrig_if_needed
|
||||
|
||||
# Clean previous build
|
||||
rm -rf "$XMRIG_SRC/build"
|
||||
|
||||
# Build dependencies (libuv, hwloc, openssl)
|
||||
info "Building xmrig-hac dependencies (libuv, hwloc, openssl)..."
|
||||
(
|
||||
@@ -421,7 +675,7 @@ else
|
||||
-DWITH_CUDA=OFF \
|
||||
-DWITH_HWLOC=ON \
|
||||
-DCMAKE_PREFIX_PATH="$XMRIG_SRC/scripts/deps"
|
||||
make -j"$(nproc)"
|
||||
make -j"$NPROC"
|
||||
)
|
||||
|
||||
# Copy binary to prebuilt-binaries
|
||||
@@ -439,18 +693,19 @@ fi
|
||||
XMRIG_WIN="$XMRIG_PREBUILT/xmrig.exe"
|
||||
|
||||
if ! $SETUP_WIN; then
|
||||
if [[ -f "$XMRIG_WIN" ]]; then
|
||||
ok "xmrig.exe (Windows) already built ($(du -h "$XMRIG_WIN" | cut -f1))"
|
||||
else
|
||||
skip "xmrig.exe (Windows) — use --win to cross-compile"
|
||||
fi
|
||||
elif [[ -f "$XMRIG_WIN" ]]; then
|
||||
ok "xmrig.exe (Windows) already built ($(du -h "$XMRIG_WIN" | cut -f1))"
|
||||
skip "xmrig.exe (Windows) — use --win to cross-compile"
|
||||
elif $CHECK_ONLY; then
|
||||
miss "xmrig.exe (Windows) not built (run setup --win without --check to build)"
|
||||
if [[ -f "$XMRIG_WIN" ]]; then
|
||||
ok "xmrig.exe (Windows) ($(du -h "$XMRIG_WIN" | cut -f1))"
|
||||
else
|
||||
miss "xmrig.exe (Windows) not built (run setup --win without --check to build)"
|
||||
fi
|
||||
else
|
||||
clone_xmrig_if_needed
|
||||
|
||||
# Clean previous Windows build
|
||||
rm -rf "$XMRIG_SRC/build-windows"
|
||||
|
||||
info "Building xmrig-hac (Windows cross-compile)..."
|
||||
(
|
||||
cd "$XMRIG_SRC/scripts"
|
||||
@@ -468,7 +723,7 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── 7. Binary directories ───────────────────────────────────────────────────
|
||||
# ── 8. Binary directories ───────────────────────────────────────────────────
|
||||
header "Binary Directories"
|
||||
|
||||
for platform in dragonxd-linux dragonxd-win dragonxd-mac xmrig; do
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user