1 Commits

Author SHA1 Message Date
2f3f320d28 Handle ReadBlockFromDisk failure during IBD gracefully
During Initial Block Download, block data may not be flushed to disk
when the wallet notification thread tries to read it. Instead of
crashing with a fatal error, log a message and retry on the next cycle.
2026-03-27 14:01:50 -05:00
24 changed files with 66 additions and 390 deletions

3
.gitignore vendored
View File

@@ -174,5 +174,4 @@ src/dragonx-cli
src/dragonx-tx src/dragonx-tx
src/dragonxd.exe src/dragonxd.exe
src/dragonx-cli.exe src/dragonx-cli.exe
src/dragonx-tx.exe src/dragonx-tx.exe
doc/relnotes/

View File

@@ -106,32 +106,19 @@ apt-get install -y gcc-7 g++-7 && \
# Build on Mac # Build on Mac
Install Xcode Command Line Tools and [Homebrew](https://brew.sh/), then install dependencies: ```
sudo port update
```sh sudo port upgrade outdated
xcode-select --install sudo port install qt5
brew install gcc autoconf automake pkgconf libtool cmake curl
# Install Rust (needed for librustzcash on macOS Sequoia+)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
# clone git repo # clone git repo
git clone https://git.hush.is/hush/hush3 git clone https://git.hush.is/hush/hush3
cd hush3 cd hush3
# Build (uses 3 build processes, you need 2GB of RAM for each) # Build
# Make sure libtool gnubin and cargo are on PATH # This uses 3 build processes, you need 2GB of RAM for each.
export PATH="$HOME/.cargo/bin:/usr/local/opt/libtool/libexec/gnubin:$PATH"
./build.sh -j3 ./build.sh -j3
``` ```
For a release build:
```sh
export PATH="$HOME/.cargo/bin:/usr/local/opt/libtool/libexec/gnubin:$PATH"
./build.sh --mac-release -j$(sysctl -n hw.ncpu)
```
# Installing Hush binaries # Installing Hush binaries
1. [Download the release](https://git.hush.is/hush/hush3/releases) with a .deb file extension. 1. [Download the release](https://git.hush.is/hush/hush3/releases) with a .deb file extension.

View File

@@ -6,7 +6,7 @@
set -eu -o pipefail set -eu -o pipefail
VERSION="1.0.2" VERSION="1.0.1"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
RELEASE_DIR="$SCRIPT_DIR/release" RELEASE_DIR="$SCRIPT_DIR/release"
@@ -80,12 +80,8 @@ package_release() {
echo "Packaging release for $platform..." echo "Packaging release for $platform..."
mkdir -p "$release_subdir" mkdir -p "$release_subdir"
# Copy bootstrap script (platform-appropriate) # Copy bootstrap script
if [ "$platform" = "win64" ]; then cp "$SCRIPT_DIR/util/bootstrap-dragonx.sh" "$release_subdir/"
cp "$SCRIPT_DIR/util/bootstrap-dragonx.bat" "$release_subdir/"
else
cp "$SCRIPT_DIR/util/bootstrap-dragonx.sh" "$release_subdir/"
fi
# Copy common files # Copy common files
cp "$SCRIPT_DIR/contrib/asmap/asmap.dat" "$release_subdir/" 2>/dev/null || true cp "$SCRIPT_DIR/contrib/asmap/asmap.dat" "$release_subdir/" 2>/dev/null || true
@@ -175,21 +171,21 @@ if [ $BUILD_LINUX_COMPAT -eq 1 ] || [ $BUILD_LINUX_RELEASE -eq 1 ] || [ $BUILD_W
if [ $BUILD_LINUX_RELEASE -eq 1 ]; then if [ $BUILD_LINUX_RELEASE -eq 1 ]; then
echo "=== Building Linux release ===" echo "=== Building Linux release ==="
clean_for_platform linux clean_for_platform linux
./util/build.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"} ./util/build.sh --disable-tests "${REMAINING_ARGS[@]}"
package_release linux-amd64 package_release linux-amd64
fi fi
if [ $BUILD_WIN_RELEASE -eq 1 ]; then if [ $BUILD_WIN_RELEASE -eq 1 ]; then
echo "=== Building Windows release ===" echo "=== Building Windows release ==="
clean_for_platform windows clean_for_platform windows
./util/build-win.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"} ./util/build-win.sh --disable-tests "${REMAINING_ARGS[@]}"
package_release win64 package_release win64
fi fi
if [ $BUILD_MAC_RELEASE -eq 1 ]; then if [ $BUILD_MAC_RELEASE -eq 1 ]; then
echo "=== Building macOS release ===" echo "=== Building macOS release ==="
clean_for_platform macos clean_for_platform macos
./util/build-mac.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"} ./util/build-mac.sh --disable-tests "${REMAINING_ARGS[@]}"
package_release macos package_release macos
fi fi
@@ -201,11 +197,11 @@ fi
# Standard build (auto-detect OS) # Standard build (auto-detect OS)
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then
./util/build.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"} ./util/build.sh --disable-tests "${REMAINING_ARGS[@]}"
elif [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "darwin"* ]]; then
./util/build-mac.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"} ./util/build-mac.sh --disable-tests "${REMAINING_ARGS[@]}"
elif [[ "$OSTYPE" == "msys"* ]]; then elif [[ "$OSTYPE" == "msys"* ]]; then
./util/build-win.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"} ./util/build-win.sh --disable-tests "${REMAINING_ARGS[@]}"
else else
echo "Unable to detect your OS. What are you using?" echo "Unable to detect your OS. What are you using?"
fi fi

View File

@@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MAJOR, 1)
dnl Must be kept in sync with src/clientversion.h , ugh! dnl Must be kept in sync with src/clientversion.h , ugh!
define(_CLIENT_VERSION_MINOR, 0) define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 2) define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 50) define(_CLIENT_VERSION_BUILD, 50)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))

View File

@@ -1,5 +1,5 @@
build_darwin_CC = gcc-15 build_darwin_CC = gcc-8
build_darwin_CXX = g++-15 build_darwin_CXX = g++-8
build_darwin_AR: = $(shell xcrun -f ar) build_darwin_AR: = $(shell xcrun -f ar)
build_darwin_RANLIB: = $(shell xcrun -f ranlib) build_darwin_RANLIB: = $(shell xcrun -f ranlib)
build_darwin_STRIP: = $(shell xcrun -f strip) build_darwin_STRIP: = $(shell xcrun -f strip)
@@ -10,8 +10,8 @@ build_darwin_SHA256SUM = shasum -a 256
build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o
#darwin host on darwin builder. overrides darwin host preferences. #darwin host on darwin builder. overrides darwin host preferences.
darwin_CC= gcc-15 darwin_CC= gcc-8
darwin_CXX= g++-15 darwin_CXX= g++-8
darwin_AR:=$(shell xcrun -f ar) darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip) darwin_STRIP:=$(shell xcrun -f strip)

View File

@@ -2,8 +2,8 @@ OSX_MIN_VERSION=10.12
OSX_SDK_VERSION=10.12 OSX_SDK_VERSION=10.12
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=253.9 LD64_VERSION=253.9
darwin_CC=gcc-15 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=g++-15 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CFLAGS=-pipe darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS) darwin_CXXFLAGS=$(darwin_CFLAGS)

View File

@@ -40,15 +40,9 @@ define $(package)_preprocess_cmds
cat $($(package)_patch_dir)/cargo.config | sed 's|CRATE_REGISTRY|$(host_prefix)/$(CRATE_REGISTRY)|' > .cargo/config cat $($(package)_patch_dir)/cargo.config | sed 's|CRATE_REGISTRY|$(host_prefix)/$(CRATE_REGISTRY)|' > .cargo/config
endef endef
ifeq ($(build_os),darwin)
define $(package)_build_cmds
CARGO=$(HOME)/.cargo/bin/cargo RUSTC=$(HOME)/.cargo/bin/rustc $(HOME)/.cargo/bin/cargo build --package librustzcash $($(package)_build_opts)
endef
else
define $(package)_build_cmds define $(package)_build_cmds
$(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts) $(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts)
endef endef
endif
define $(package)_stage_cmds define $(package)_stage_cmds
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \ mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \

View File

@@ -1,8 +0,0 @@
#!/bin/sh
# Strip rust.metadata.bin from .rlib archives for macOS linker compatibility
RLIB_DIR="$1"
if [ -d "$RLIB_DIR" ]; then
for rlib in "$RLIB_DIR"/*.rlib; do
[ -f "$rlib" ] && ar d "$rlib" rust.metadata.bin 2>/dev/null || true
done
fi

View File

@@ -594,7 +594,7 @@ libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBOOST_SPIRIT_THREADSAFE -DHAV
#libzcash_a_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) #libzcash_a_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
#libzcash_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMONTGOMERY_OUTPUT #libzcash_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMONTGOMERY_OUTPUT
libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu++17 libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu17
libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS) libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
@@ -636,7 +636,7 @@ libhush_a_SOURCES = \
libhush_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) -pipe -O1 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES) libhush_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) -pipe -O1 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
libhush_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu++17 libhush_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu17
libhush_a_LDFLAGS = $(HARDENED_LDFLAGS) libhush_a_LDFLAGS = $(HARDENED_LDFLAGS)

View File

@@ -1,5 +1,5 @@
SHELL = /bin/sh SHELL = /bin/sh
CC_DARWIN = g++-15 CC_DARWIN = g++-8
CC_WIN = x86_64-w64-mingw32-gcc-posix CC_WIN = x86_64-w64-mingw32-gcc-posix
CC_AARCH64 = aarch64-linux-gnu-g++ CC_AARCH64 = aarch64-linux-gnu-g++
CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib

Binary file not shown.

View File

@@ -32,12 +32,8 @@ class CChainPower;
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
extern bool fZindex; extern bool fZindex;
// These version thresholds control whether nSproutValue/nSaplingValue are static const int SPROUT_VALUE_VERSION = 1001400;
// serialized in the block index. They must be <= CLIENT_VERSION or the static const int SAPLING_VALUE_VERSION = 1010100;
// values will never be persisted, causing nChainSaplingValue to reset
// to 0 after node restart. DragonX CLIENT_VERSION is 1000250 (v1.0.2.50).
static const int SPROUT_VALUE_VERSION = 1000000;
static const int SAPLING_VALUE_VERSION = 1000000;
extern int32_t ASSETCHAINS_LWMAPOS; extern int32_t ASSETCHAINS_LWMAPOS;
extern char SMART_CHAIN_SYMBOL[65]; extern char SMART_CHAIN_SYMBOL[65];
extern uint64_t ASSETCHAINS_NOTARY_PAY[]; extern uint64_t ASSETCHAINS_NOTARY_PAY[];

View File

@@ -30,7 +30,7 @@
// Must be kept in sync with configure.ac , ugh! // Must be kept in sync with configure.ac , ugh!
#define CLIENT_VERSION_MAJOR 1 #define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 0 #define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 2 #define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 50 #define CLIENT_VERSION_BUILD 50
//! Set to true for release, false for prerelease or test build //! Set to true for release, false for prerelease or test build

View File

@@ -47,7 +47,7 @@ bool sanity_test_range_fmt()
{ {
std::string test; std::string test;
try { try {
(void)test.at(1); test.at(1);
} catch (const std::out_of_range&) { } catch (const std::out_of_range&) {
return true; return true;
} catch (...) { } catch (...) {

View File

@@ -51,9 +51,8 @@ namespace port {
// Mac OS // Mac OS
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
#include <atomic>
inline void MemoryBarrier() { inline void MemoryBarrier() {
std::atomic_thread_fence(std::memory_order_seq_cst); OSMemoryBarrier();
} }
#define LEVELDB_HAVE_MEMORY_BARRIER #define LEVELDB_HAVE_MEMORY_BARRIER

Binary file not shown.

View File

@@ -33,8 +33,6 @@
#include "crypto/common.h" #include "crypto/common.h"
#include "hush/utiltls.h" #include "hush/utiltls.h"
#include <random.h> #include <random.h>
#include <random>
#include <limits>
#ifdef _WIN32 #ifdef _WIN32
#include <string.h> #include <string.h>
#else #else
@@ -2006,7 +2004,7 @@ void ThreadMessageHandler()
// Randomize the order in which we process messages from/to our peers. // Randomize the order in which we process messages from/to our peers.
// This prevents attacks in which an attacker exploits having multiple // This prevents attacks in which an attacker exploits having multiple
// consecutive connections in the vNodes list. // consecutive connections in the vNodes list.
std::shuffle(vNodesCopy.begin(), vNodesCopy.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max()))); random_shuffle(vNodesCopy.begin(), vNodesCopy.end(), GetRandInt);
BOOST_FOREACH(CNode* pnode, vNodesCopy) BOOST_FOREACH(CNode* pnode, vNodesCopy)
{ {
@@ -2518,7 +2516,7 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
// We always round down, except when we have only 1 connection // We always round down, except when we have only 1 connection
auto newSize = (vNodes.size() / 2) == 0 ? 1 : (vNodes.size() / 2); auto newSize = (vNodes.size() / 2) == 0 ? 1 : (vNodes.size() / 2);
std::shuffle( vRelayNodes.begin(), vRelayNodes.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max())) ); random_shuffle( vRelayNodes.begin(), vRelayNodes.end(), GetRandInt );
vRelayNodes.resize(newSize); vRelayNodes.resize(newSize);
if (HUSH_TESTNODE==1 && vNodes.size() == 0) { if (HUSH_TESTNODE==1 && vNodes.size() == 0) {

View File

@@ -322,15 +322,6 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
result.push_back(Pair("anchor", blockindex->hashFinalSproutRoot.GetHex())); result.push_back(Pair("anchor", blockindex->hashFinalSproutRoot.GetHex()));
result.push_back(Pair("blocktype", "mined")); result.push_back(Pair("blocktype", "mined"));
// Report block subsidy and fees separately so explorers don't have to
// reimplement the reward schedule to display them.
CAmount nSubsidy = GetBlockSubsidy(blockindex->GetHeight(), Params().GetConsensus());
CAmount nCoinbase = block.vtx[0].GetValueOut();
CAmount nFees = nCoinbase - nSubsidy;
if (nFees < 0) nFees = 0; // block 1 has premine, avoid negative
result.push_back(Pair("subsidy", ValueFromAmount(nSubsidy)));
result.push_back(Pair("fees", ValueFromAmount(nFees)));
UniValue valuePools(UniValue::VARR); UniValue valuePools(UniValue::VARR);
valuePools.push_back(ValuePoolDesc("sapling", blockindex->nChainSaplingValue, blockindex->nSaplingValue)); valuePools.push_back(ValuePoolDesc("sapling", blockindex->nChainSaplingValue, blockindex->nSaplingValue));
result.push_back(Pair("valuePools", valuePools)); result.push_back(Pair("valuePools", valuePools));

View File

@@ -11,8 +11,6 @@
#include <boost/optional/optional_io.hpp> #include <boost/optional/optional_io.hpp>
#include <librustzcash.h> #include <librustzcash.h>
#include "zcash/Note.hpp" #include "zcash/Note.hpp"
#include <random>
#include <limits>
extern bool fZDebug; extern bool fZDebug;
SpendDescriptionInfo::SpendDescriptionInfo( SpendDescriptionInfo::SpendDescriptionInfo(
@@ -68,7 +66,7 @@ void TransactionBuilder::AddSaplingOutput(
void TransactionBuilder::ShuffleOutputs() void TransactionBuilder::ShuffleOutputs()
{ {
LogPrintf("%s: Shuffling %d zouts\n", __func__, outputs.size() ); LogPrintf("%s: Shuffling %d zouts\n", __func__, outputs.size() );
std::shuffle( outputs.begin(), outputs.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max())) ); random_shuffle( outputs.begin(), outputs.end(), GetRandInt );
} }
void TransactionBuilder::AddTransparentInput(COutPoint utxo, CScript scriptPubKey, CAmount value, uint32_t _nSequence) void TransactionBuilder::AddTransparentInput(COutPoint utxo, CScript scriptPubKey, CAmount value, uint32_t _nSequence)

View File

@@ -179,6 +179,13 @@ void ThreadNotifyWallets(CBlockIndex *pindexLastTip)
// Read block from disk. // Read block from disk.
CBlock block; CBlock block;
if (!ReadBlockFromDisk(block, pindexLastTip,1)) { if (!ReadBlockFromDisk(block, pindexLastTip,1)) {
if (IsInitialBlockDownload()) {
// During IBD, block data may not be flushed to disk yet.
// Sleep briefly and retry on the next cycle instead of crashing.
LogPrintf("%s: block at height %d not yet readable, will retry\n",
__func__, pindexLastTip->GetHeight());
break;
}
LogPrintf("*** %s\n", "Failed to read block while notifying wallets of block disconnects"); LogPrintf("*** %s\n", "Failed to read block while notifying wallets of block disconnects");
uiInterface.ThreadSafeMessageBox( uiInterface.ThreadSafeMessageBox(
_("Error: A fatal internal error occurred, see debug.log for details"), _("Error: A fatal internal error occurred, see debug.log for details"),
@@ -206,6 +213,14 @@ void ThreadNotifyWallets(CBlockIndex *pindexLastTip)
// Read block from disk. // Read block from disk.
CBlock block; CBlock block;
if (!ReadBlockFromDisk(block, blockData.pindex, 1)) { if (!ReadBlockFromDisk(block, blockData.pindex, 1)) {
if (IsInitialBlockDownload()) {
// During IBD, block data may not be flushed to disk yet.
// Push unprocessed blocks back and retry on the next cycle.
LogPrintf("%s: block at height %d not yet readable, will retry\n",
__func__, blockData.pindex->GetHeight());
blockStack.push_back(blockData);
break;
}
LogPrintf("*** %s\n", "Failed to read block while notifying wallets of block connects"); LogPrintf("*** %s\n", "Failed to read block while notifying wallets of block connects");
uiInterface.ThreadSafeMessageBox( uiInterface.ThreadSafeMessageBox(
_("Error: A fatal internal error occurred, see debug.log for details"), _("Error: A fatal internal error occurred, see debug.log for details"),

View File

@@ -39,8 +39,6 @@
#include "coins.h" #include "coins.h"
#include "wallet/asyncrpcoperation_saplingconsolidation.h" #include "wallet/asyncrpcoperation_saplingconsolidation.h"
#include "wallet/asyncrpcoperation_sweep.h" #include "wallet/asyncrpcoperation_sweep.h"
#include <random>
#include <limits>
#include "zcash/zip32.h" #include "zcash/zip32.h"
#include "cc/CCinclude.h" #include "cc/CCinclude.h"
#include <assert.h> #include <assert.h>
@@ -3418,7 +3416,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
vector<pair<CAmount, pair<const CWalletTx*,unsigned int> > > vValue; vector<pair<CAmount, pair<const CWalletTx*,unsigned int> > > vValue;
CAmount nTotalLower = 0; CAmount nTotalLower = 0;
std::shuffle(vCoins.begin(), vCoins.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max()))); random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt);
BOOST_FOREACH(const COutput &output, vCoins) BOOST_FOREACH(const COutput &output, vCoins)
{ {

View File

@@ -1,264 +0,0 @@
@echo off
REM Copyright 2024 The Hush Developers
REM Copyright 2024 The DragonX Developers
REM Released under the GPLv3
REM
REM Download and apply a DRAGONX blockchain bootstrap on Windows.
REM Safely preserves wallet.dat and configuration files.
setlocal enabledelayedexpansion
set "BOOTSTRAP_BASE_URL=https://bootstrap.dragonx.is"
set "BOOTSTRAP_FALLBACK_URL=https://bootstrap2.dragonx.is"
set "BOOTSTRAP_FILE=DRAGONX.zip"
set "CHAIN_NAME=DRAGONX"
REM Data directory on Windows
set "DATADIR=%APPDATA%\Hush\%CHAIN_NAME%"
REM Find dragonx-cli relative to this script
set "CLI="
set "SCRIPT_DIR=%~dp0"
if exist "%SCRIPT_DIR%dragonx-cli.exe" (
set "CLI=%SCRIPT_DIR%dragonx-cli.exe"
)
echo ============================================
echo DragonX Bootstrap Installer
echo ============================================
echo.
echo [INFO] Data directory: %DATADIR%
echo.
REM Step 1: Stop daemon if running
call :stop_daemon
if errorlevel 1 goto :error_exit
REM Step 2: Clean old chain data
call :clean_chain_data
if errorlevel 1 goto :error_exit
REM Step 3: Download bootstrap
call :download_bootstrap
if errorlevel 1 goto :error_exit
REM Step 4: Extract bootstrap
call :extract_bootstrap
if errorlevel 1 goto :error_exit
echo.
echo [INFO] Bootstrap installation complete!
echo [INFO] You can now start DragonX with: dragonxd.exe
echo.
goto :EOF
REM ============================================
REM Stop daemon if running
REM ============================================
:stop_daemon
if "%CLI%"=="" (
echo [WARN] dragonx-cli.exe not found next to this script.
echo [WARN] Please make sure the DragonX daemon is stopped before continuing.
set /p "ANSWER=Is the DragonX daemon stopped? (y/N): "
if /i not "!ANSWER!"=="y" (
echo [ERROR] Please stop the daemon first and run this script again.
exit /b 1
)
exit /b 0
)
"%CLI%" getinfo >nul 2>&1
if errorlevel 1 (
echo [INFO] Daemon is not running.
exit /b 0
)
echo [INFO] Stopping DragonX daemon...
"%CLI%" stop >nul 2>&1
set "TRIES=0"
:wait_loop
"%CLI%" getinfo >nul 2>&1
if errorlevel 1 goto :daemon_stopped
timeout /t 2 /nobreak >nul
set /a TRIES+=1
if %TRIES% geq 60 (
echo [ERROR] Daemon did not stop after 120 seconds. Please stop it manually and retry.
exit /b 1
)
goto :wait_loop
:daemon_stopped
echo [INFO] Daemon stopped.
exit /b 0
REM ============================================
REM Clean blockchain data, preserving wallet and config
REM ============================================
:clean_chain_data
if not exist "%DATADIR%" (
echo [INFO] Data directory does not exist yet, creating it.
mkdir "%DATADIR%"
exit /b 0
)
echo [INFO] Cleaning blockchain data from %DATADIR% ...
REM Preserve wallet.dat and config
set "TMPDIR=%TEMP%\dragonx-bootstrap-%RANDOM%"
mkdir "%TMPDIR%" 2>nul
for %%F in (wallet.dat DRAGONX.conf peers.dat) do (
if exist "%DATADIR%\%%F" (
copy /y "%DATADIR%\%%F" "%TMPDIR%\%%F" >nul
)
)
REM Remove blockchain directories and files
for %%D in (blocks chainstate notarizations komodo) do (
if exist "%DATADIR%\%%D" (
rmdir /s /q "%DATADIR%\%%D" 2>nul
)
)
for %%F in (db.log debug.log fee_estimates.dat banlist.dat) do (
if exist "%DATADIR%\%%F" (
del /f /q "%DATADIR%\%%F" 2>nul
)
)
REM Restore preserved files
for %%F in (wallet.dat DRAGONX.conf peers.dat) do (
if exist "%TMPDIR%\%%F" (
copy /y "%TMPDIR%\%%F" "%DATADIR%\%%F" >nul
)
)
rmdir /s /q "%TMPDIR%" 2>nul
echo [INFO] Blockchain data cleaned.
exit /b 0
REM ============================================
REM Download bootstrap (with fallback)
REM ============================================
:download_bootstrap
echo [INFO] Downloading bootstrap from %BOOTSTRAP_BASE_URL% ...
echo [INFO] This may take a while depending on your connection speed.
REM Try primary URL
call :do_download "%BOOTSTRAP_BASE_URL%"
if not errorlevel 1 goto :download_verify
echo [WARN] Primary download failed, trying fallback %BOOTSTRAP_FALLBACK_URL% ...
call :do_download "%BOOTSTRAP_FALLBACK_URL%"
if errorlevel 1 (
echo [ERROR] Download failed from both primary and fallback servers.
exit /b 1
)
:download_verify
echo [INFO] Bootstrap download complete.
REM Verify SHA256 checksum
echo [INFO] Verifying checksum...
pushd "%DATADIR%"
REM Read expected hash from the .sha256 file (format: "hash filename" or "hash *filename")
set "EXPECTED_HASH="
for /f "tokens=1" %%A in (%BOOTSTRAP_FILE%.sha256) do (
set "EXPECTED_HASH=%%A"
)
if "%EXPECTED_HASH%"=="" (
echo [WARN] Could not read expected checksum, skipping verification.
goto :verify_done
)
REM Use certutil to compute SHA256
certutil -hashfile "%BOOTSTRAP_FILE%" SHA256 > "%TEMP%\dragonx_hash.tmp" 2>nul
if errorlevel 1 (
echo [WARN] certutil not available, skipping checksum verification.
goto :verify_done
)
REM certutil outputs hash on the second line
set "ACTUAL_HASH="
set "LINE_NUM=0"
for /f "skip=1 tokens=*" %%H in (%TEMP%\dragonx_hash.tmp) do (
if not defined ACTUAL_HASH (
set "ACTUAL_HASH=%%H"
)
)
REM Remove spaces from certutil output
set "ACTUAL_HASH=!ACTUAL_HASH: =!"
del /f /q "%TEMP%\dragonx_hash.tmp" 2>nul
if /i "!ACTUAL_HASH!"=="!EXPECTED_HASH!" (
echo [INFO] SHA256 checksum verified.
) else (
echo [ERROR] SHA256 checksum verification failed! The download may be corrupted.
echo [ERROR] Expected: !EXPECTED_HASH!
echo [ERROR] Got: !ACTUAL_HASH!
popd
exit /b 1
)
:verify_done
REM Clean up checksum files
del /f /q "%BOOTSTRAP_FILE%.md5" 2>nul
del /f /q "%BOOTSTRAP_FILE%.sha256" 2>nul
popd
exit /b 0
REM ============================================
REM Download files from a given base URL
REM Usage: call :do_download "base_url"
REM ============================================
:do_download
set "BASE=%~1"
REM Use PowerShell to download (available on all modern Windows)
echo [INFO] Downloading %BASE%/%BOOTSTRAP_FILE% ...
powershell -NoProfile -Command ^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; try { (New-Object Net.WebClient).DownloadFile('%BASE%/%BOOTSTRAP_FILE%', '%DATADIR%\%BOOTSTRAP_FILE%') } catch { exit 1 }"
if errorlevel 1 exit /b 1
echo [INFO] Downloading checksums...
powershell -NoProfile -Command ^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; try { (New-Object Net.WebClient).DownloadFile('%BASE%/%BOOTSTRAP_FILE%.md5', '%DATADIR%\%BOOTSTRAP_FILE%.md5') } catch { exit 1 }"
if errorlevel 1 exit /b 1
powershell -NoProfile -Command ^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; try { (New-Object Net.WebClient).DownloadFile('%BASE%/%BOOTSTRAP_FILE%.sha256', '%DATADIR%\%BOOTSTRAP_FILE%.sha256') } catch { exit 1 }"
if errorlevel 1 exit /b 1
exit /b 0
REM ============================================
REM Extract bootstrap zip
REM ============================================
:extract_bootstrap
echo [INFO] Extracting bootstrap...
pushd "%DATADIR%"
REM Use PowerShell to extract zip, excluding wallet.dat and .conf files
powershell -NoProfile -Command ^
"Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip = [System.IO.Compression.ZipFile]::OpenRead('%DATADIR%\%BOOTSTRAP_FILE%'); foreach ($entry in $zip.Entries) { if ($entry.Name -eq 'wallet.dat' -or $entry.Name -like '*.conf') { continue } $dest = Join-Path '%DATADIR%' $entry.FullName; if ($entry.FullName.EndsWith('/')) { New-Item -ItemType Directory -Force -Path $dest | Out-Null } else { $parent = Split-Path $dest -Parent; if (-not (Test-Path $parent)) { New-Item -ItemType Directory -Force -Path $parent | Out-Null } [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $dest, $true) } }; $zip.Dispose()"
if errorlevel 1 (
echo [ERROR] Extraction failed.
popd
exit /b 1
)
echo [INFO] Bootstrap extracted successfully.
REM Clean up archive
del /f /q "%BOOTSTRAP_FILE%" 2>nul
echo [INFO] Removed downloaded archive to save disk space.
popd
exit /b 0
:error_exit
echo.
echo [ERROR] Bootstrap installation failed.
exit /b 1

View File

@@ -9,7 +9,6 @@
set -euo pipefail set -euo pipefail
BOOTSTRAP_BASE_URL="https://bootstrap.dragonx.is" BOOTSTRAP_BASE_URL="https://bootstrap.dragonx.is"
BOOTSTRAP_FALLBACK_URL="https://bootstrap2.dragonx.is"
BOOTSTRAP_FILE="DRAGONX.zip" BOOTSTRAP_FILE="DRAGONX.zip"
CHAIN_NAME="DRAGONX" CHAIN_NAME="DRAGONX"
@@ -119,49 +118,35 @@ clean_chain_data() {
info "Blockchain data cleaned." info "Blockchain data cleaned."
} }
# Download a file via wget or curl (returns non-zero on failure) # Download a file via wget or curl
download_file() { download_file() {
local url="$1" local url="$1"
local outfile="$2" local outfile="$2"
if command -v wget &>/dev/null; then if command -v wget &>/dev/null; then
wget --progress=bar:force -O "$outfile" "$url" wget --progress=bar:force -O "$outfile" "$url" || error "Download failed: $url"
elif command -v curl &>/dev/null; then elif command -v curl &>/dev/null; then
curl -L --progress-bar -o "$outfile" "$url" curl -L --progress-bar -o "$outfile" "$url" || error "Download failed: $url"
else else
error "Neither wget nor curl found. Please install one and retry." error "Neither wget nor curl found. Please install one and retry."
fi fi
} }
# Try downloading from a given base URL; returns non-zero on failure
download_from() {
local base_url="$1"
local outfile="$DATADIR/$BOOTSTRAP_FILE"
local md5file="$DATADIR/${BOOTSTRAP_FILE}.md5"
local sha256file="$DATADIR/${BOOTSTRAP_FILE}.sha256"
info "Downloading bootstrap from $base_url ..."
info "This may take a while depending on your connection speed."
download_file "$base_url/$BOOTSTRAP_FILE" "$outfile" || return 1
info "Bootstrap download complete."
info "Downloading checksums..."
download_file "$base_url/${BOOTSTRAP_FILE}.md5" "$md5file" || return 1
download_file "$base_url/${BOOTSTRAP_FILE}.sha256" "$sha256file" || return 1
return 0
}
# Download the bootstrap and verify checksums # Download the bootstrap and verify checksums
download_bootstrap() { download_bootstrap() {
local outfile="$DATADIR/$BOOTSTRAP_FILE" local outfile="$DATADIR/$BOOTSTRAP_FILE"
local md5file="$DATADIR/${BOOTSTRAP_FILE}.md5" local md5file="$DATADIR/${BOOTSTRAP_FILE}.md5"
local sha256file="$DATADIR/${BOOTSTRAP_FILE}.sha256" local sha256file="$DATADIR/${BOOTSTRAP_FILE}.sha256"
if ! download_from "$BOOTSTRAP_BASE_URL"; then info "Downloading bootstrap from $BOOTSTRAP_BASE_URL ..."
warn "Primary download failed, trying fallback $BOOTSTRAP_FALLBACK_URL ..." info "This may take a while depending on your connection speed."
download_from "$BOOTSTRAP_FALLBACK_URL" || error "Download failed from both primary and fallback servers."
fi download_file "$BOOTSTRAP_BASE_URL/$BOOTSTRAP_FILE" "$outfile"
info "Bootstrap download complete."
info "Downloading checksums..."
download_file "$BOOTSTRAP_BASE_URL/${BOOTSTRAP_FILE}.md5" "$md5file"
download_file "$BOOTSTRAP_BASE_URL/${BOOTSTRAP_FILE}.sha256" "$sha256file"
# Verify checksums # Verify checksums
info "Verifying checksums..." info "Verifying checksums..."

View File

@@ -3,8 +3,8 @@
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
export CC=gcc-15 export CC=gcc-8
export CXX=g++-15 export CXX=g++-8
export LIBTOOL=libtool export LIBTOOL=libtool
export AR=ar export AR=ar
export RANLIB=ranlib export RANLIB=ranlib
@@ -34,24 +34,16 @@ fi
# If --enable-lcov is the first argument, enable lcov coverage support: # If --enable-lcov is the first argument, enable lcov coverage support:
LCOV_ARG='' LCOV_ARG=''
HARDENING_ARG='--disable-hardening' HARDENING_ARG='--disable-hardening'
TEST_ARG=''
if [ "x${1:-}" = 'x--enable-lcov' ] if [ "x${1:-}" = 'x--enable-lcov' ]
then then
LCOV_ARG='--enable-lcov' LCOV_ARG='--enable-lcov'
HARDENING_ARG='--disable-hardening' HARDENING_ARG='--disable-hardening'
shift shift
elif [ "x${1:-}" = 'x--disable-tests' ]
then
TEST_ARG='--enable-tests=no'
shift
fi fi
TRIPLET=`./depends/config.guess` TRIPLET=`./depends/config.guess`
PREFIX="$(pwd)/depends/$TRIPLET" PREFIX="$(pwd)/depends/$TRIPLET"
# Ensure system Rust is in PATH for modern macOS compatibility
export PATH="$HOME/.cargo/bin:$PATH"
make "$@" -C ./depends/ V=1 NO_QT=1 make "$@" -C ./depends/ V=1 NO_QT=1
#BUILD CCLIB #BUILD CCLIB
@@ -76,7 +68,7 @@ cd $WD
./autogen.sh ./autogen.sh
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc/15.2.0_1/include/c++/15/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -Wno-error=deprecated-declarations -g -Wl,-undefined -Wl,dynamic_lookup' \ CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" $TEST_ARG ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
make "$@" V=1 NO_GTEST=1 STATIC=1 make "$@" V=1 NO_GTEST=1 STATIC=1