From 04ad1462d529dc6d912fe44ff08f8119879c60f9 Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 11 Oct 2026 06:05:07 -0500 Subject: [PATCH] build(win-release): drop the unused loose xmrig.exe from Windows zips Both Windows zips shipped a loose xmrig.exe next to the wallet exe. The exe already embeds xmrig (HAS_EMBEDDED_XMRIG), and getXmrigPath() uses, and re-extracts when needed, the copy under %APPDATA%\\dragonx; it looks next to the exe only when that extraction fails. build_release_win now copies it only when the generated header does not define HAS_EMBEDDED_XMRIG, or there is no header. Measured: each Windows zip loses exactly one entry, xmrig.exe; with the ImGui demo stubs, the full-node zip went from 167,515,430 to 164,554,177 bytes. The loose dragonxd, dragonx-cli, dragonx-tx, wallet-rebuild helper, params and asmap stay in the full-node zip. The daemon copy under %APPDATA% is written once and never refreshed, so without the loose copy existing zip users would silently run their first-install daemon. Dropping them needs a migration first. Not verifiable here: mining from an unzipped Windows build without the loose xmrig.exe. Co-Authored-By: Claude Opus 5.5 --- build.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 6bdbe08..ac781e2 100755 --- a/build.sh +++ b/build.sh @@ -911,9 +911,14 @@ HDR info "Lite mode: skipping daemon and Sapling/asmap assets in Windows zip" fi - # Bundle xmrig for mining support - local XMRIG_WIN="$SCRIPT_DIR/prebuilt-binaries/drg-xmrig/xmrig.exe" - [[ -f "$XMRIG_WIN" ]] && { cp "$XMRIG_WIN" "$dist_dir/"; info "Bundled xmrig.exe"; } || warn "xmrig.exe not found — mining unavailable in zip" + # The exe embeds xmrig (HAS_EMBEDDED_XMRIG) and getXmrigPath() always prefers / re-extracts the copy in + # %APPDATA%\\dragonx, so a loose exe-dir xmrig.exe is never used. Ship it loose only when not embedded. + if grep -q '^#define HAS_EMBEDDED_XMRIG 1' "$GEN/embedded_data.h" 2>/dev/null; then + info "xmrig.exe is embedded in the exe — not copied loose into the zip" + else + local XMRIG_WIN="$SCRIPT_DIR/prebuilt-binaries/drg-xmrig/xmrig.exe" + [[ -f "$XMRIG_WIN" ]] && { cp "$XMRIG_WIN" "$dist_dir/"; info "Bundled xmrig.exe"; } || warn "xmrig.exe not found — mining unavailable in zip" + fi cp -r bin/res "$dist_dir/" 2>/dev/null || true