Fix RandomX validation exploit with difficulty reset, improve build system

- One-time difficulty reset to minimum for 17 blocks at activation height
- Separate RandomX build dirs for linux/win64 cross-compilation
- Add build target tracking to auto-clean on target switch
- Automated win64 release packaging to release-win64/
- Add build artifacts to .gitignore
- Miner memory diagnostics and large-page dataset fallback
This commit is contained in:
dan_s
2026-02-19 22:07:38 -06:00
parent 16149aed5a
commit 8a0eb77692
11 changed files with 395 additions and 37 deletions

View File

@@ -5,13 +5,52 @@
set -eu -o pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_TARGET_FILE="$SCRIPT_DIR/src/.build_target"
# Function to check and clean if target changed
check_and_clean_target() {
local new_target="$1"
local current_target=""
if [[ -f "$BUILD_TARGET_FILE" ]]; then
current_target=$(cat "$BUILD_TARGET_FILE")
fi
if [[ -n "$current_target" && "$current_target" != "$new_target" ]]; then
echo "Build target changed from '$current_target' to '$new_target'"
echo "Cleaning old build artifacts to prevent cross-compilation contamination..."
cd "$SCRIPT_DIR"
make distclean 2>/dev/null || true
# Clean leveldb separately as it often causes issues
if [[ -d src/leveldb ]]; then
make -C src/leveldb clean 2>/dev/null || true
fi
echo "Clean complete."
fi
# Record the new target
echo "$new_target" > "$BUILD_TARGET_FILE"
}
# Check for --win-release flag for cross-compilation
if [[ "${1:-}" == "--win-release" ]]; then
check_and_clean_target "windows"
shift
./util/build-win.sh "$@"
exit $?
fi
# run correct build script for detected OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
./util/build.sh --disable-tests $@
check_and_clean_target "linux"
./util/build.sh --disable-tests "$@"
elif [[ "$OSTYPE" == "darwin"* ]]; then
./util/build-mac.sh --disable-tests $@
check_and_clean_target "macos"
./util/build-mac.sh --disable-tests "$@"
elif [[ "$OSTYPE" == "msys"* ]]; then
./util/build-win.sh --disable-tests $@
check_and_clean_target "windows"
./util/build-win.sh --disable-tests "$@"
#elif [[ "$OSTYPE" == "freebsd"* ]]; then
# placeholder
else