Commit Graph

1062 Commits

Author SHA1 Message Date
693d2290e0 fix: release RandomX pre-verify cache at shutdown; tune verify-threads help + -maxblocksintransit ceiling
Three small cleanups to the parallel RandomX pre-verify + P2P-window features:

- Call RandomXValidatorShutdown() in Shutdown() to release the ~256MB shared RandomX
  verify cache. It was allocated on first use but never freed, leaking at every exit.
  Safe here: threadGroup.interrupt_all() (earlier in Shutdown) stops the pre-verify
  worker, and the release takes g_rxvMutex so it can't race a mid-flight verify.
- Clarify the -randomxverifythreads help: the pool only helps NETWORK sync, not reindex
  (reindex runs with a window of 1, so the pool does nothing there).
- Clamp -maxblocksintransit to the real BLOCK_DOWNLOAD_WINDOW (1024) ceiling instead of a
  misleading 4096. Values above the window are a silent no-op (FindNextBlocksToDownload
  never fetches beyond pindexLastCommonBlock + BLOCK_DOWNLOAD_WINDOW); log when clamping.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 06:59:25 +02:00
4238da9bea fix: cap indexed-node block-tree dbcache so adaptive dbcache feeds the UTXO set
With -addressindex/-spentindex, nBlockTreeDBCache was set to 3/4 of nTotalCache. That
rule was sized for the old fixed 512 MiB dbcache default (~384 MiB), but adaptive
dbcache now makes nTotalCache multi-GB, so on indexed pool/explorer nodes ~3/4 of
several GB was diverted to the block-index LevelDB read cache -- far more than it can
use -- while starving the in-memory UTXO set that actually speeds IBD, and that chunk
is not shrinkable by the memory-pressure controller.

Measured on an 8 GiB box with -addressindex: 4420 MiB block-index cache + 1097 MiB
UTXO set, vs 3859 MiB UTXO on a plain node. Cap the index cache at 1 GiB (ample for
the index read cache; tunable) so the adaptive budget flows to the coins cache.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:26:30 +02:00
19e1ce6f00 fix: self-heal a corrupt/torn notarizations DB instead of aborting startup
A torn or corrupt notarizations (dPoW) leveldb -- a 0-byte log left by a torn
snapshot, or a corrupt MANIFEST -- threw at open and was caught by the block-DB
load try/catch, aborting startup with a misleading Error-opening-block-database
message and forcing a full resync. The notarizations DB is non-essential and
node-regenerable, so on open failure move it aside (notarizations.corrupt,
preserving the data in case the error was transient) and regenerate a fresh one;
if the fresh recreate also fails it still propagates as fatal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 05:48:39 +02:00
4caf2fc68f Add BIP39 seed phrases (SilentDragonXLite-compatible) and HD transparent keys
Derive transparent (t-addr) keys from the HD seed and add BIP39 mnemonic seed
phrases that are byte-for-byte compatible with SilentDragonXLite, so the same
24 words recover the same shielded and transparent addresses in either wallet.

HD transparent keys:
- Derive t-keys from the seed at m/44'/coin'/0'/0/i (were random CKeys).
- CHDChain gains a version-gated transparent counter; existing wallets load
  unchanged. GenerateNewKey routes through DeriveNewChildKey when enabled
  (-hdtransparent, default on).
- Restore from a seed hex via -hdseed with gap-limit pre-derivation; birthday
  pinned to genesis so the rescan is not clipped.

BIP39 seed phrases:
- Wire the vendored trezor BIP39 lib (src/crypto/bip39) into the build, fix its
  BIP39_WORDS guard, and disable the insecure mnemonic cache.
- Match SDXLite exactly: English wordlist, empty passphrase, PBKDF2 64-byte
  seed, coin type 141, ZIP-32 m/32'/141'/i' and BIP44 m/44'/141'/0'/0/i. Store
  the 32-byte entropy and expand to the 64-byte seed on demand.
- Restore via -mnemonic, create via -usemnemonic, reveal via z_exportmnemonic.

Verified by gtests including a known-answer BIP39 seed vector and z/t address
derivation checks (src/gtest/test_hdtransparent.cpp, test_mnemonic_compat.cpp).
Docs in doc/hd-transparent-keys.md and doc/seed-phrase.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 01:57:18 -05:00
84aefb5475 Remove assumeutxo / UTXO-snapshot feature
Removes the dumptxoutset RPC, -loadutxosnapshot / -loadutxosnapshotunsafe,
the CCoinsViewDB Dump/LoadSnapshot machinery + CUTXOSnapshotHeader, the
AssumeutxoData chainparams anchor, the LoadSnapshotChainstate activation +
reorg-below-H guard, the persisted assumeutxo-height flag, and the gtest.

Rationale: it duplicated the existing bootstrap (same skip-the-genesis-grind
fast-sync, no speed advantage), its only real edge was a trust model we don't
need for this chain, and it was inert anyway (no published snapshot hash in
chainparams). The -loadutxosnapshot load path adopted an external UTXO set and
bypassed genesis validation, so removing it also drops that attack surface.
Builds clean (no dangling references); the kept IBD speedups (RandomX
pre-verify, adaptive dbcache, tlsmanager) are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 16:42:37 -05:00
1f2b109d95 Add opt-in bulk block streaming (-bulkblocksync)
A single getblockstrm request makes a peer stream a contiguous range of old
blocks back-to-back as ordinary BLOCK messages, amortizing the per-block
round-trip over the whole range instead of the MAX_BLOCKS_IN_TRANSIT_PER_PEER
window. This targets the bandwidth-delay-product ceiling that dominates IBD
from few/high-latency peers below the checkpoint.

Design (off by default; negotiated via a NODE_BULKBLOCKS service bit; the
default getdata IBD path is untouched when disabled):
- protocol: NODE_BULKBLOCKS service bit + getblockstrm/blockstream messages.
- requester: in SendMessages, after FindNextBlocksToDownload, when the first
  needed block is >= BULK_TIP_MARGIN (5000) below the network tip and the peer
  advertises the bit and we are in IBD, request a contiguous range (<=128
  blocks) instead of per-block getdata; mark the range in-flight.
- server: stream the range (caps 128 blocks / 8 MiB; reads outside cs_main;
  per-peer flood throttle), then a trailing blockstream header with the actual
  count sent. Self-suppresses while the server itself is in IBD.
- received blocks ride the existing BLOCK -> ProcessNewBlock path (fully
  validated; checkpoints below 2.84M still apply); the trailing header
  reconciles partial deliveries and the range is freed on a 90s timeout, so a
  partial/withheld/refused batch falls back to the normal path (no leak, no
  permanent gap, no disconnect). In-flight tracking is by literal hash, so a
  reorg cannot orphan range entries.

Hardened against the issues found in two adversarial review passes (drain vs
timeout, partial reconciliation, ownership-guarded frees, one-shot header,
reorg-proof helpers, cs_main hold). Validated end-to-end between two local
v1.0.3 nodes (128/128 and partial serves; height advanced; no errors).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 21:22:54 -05:00
78ea2aac5b Add -maxblocksintransit: tunable per-peer block-download window
The per-peer in-flight block window (MAX_BLOCKS_IN_TRANSIT_PER_PEER) was a
hardcoded 16. On a single, high-latency peer during IBD the transfer is
bandwidth-delay-product bound (window / RTT), so with tiny sub-checkpoint
blocks the window, not bandwidth, is the ceiling — measured ~4x throughput
going 16 -> 64 on a 350ms-RTT peer. Make it a runtime flag (default 16,
clamped 1..4096), logged at startup. No behavior change at the default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 21:22:32 -05:00
1673cfb6dc IBD/sync speedups: parallel RandomX pre-verify, adaptive dbcache, P2P download fixes
- Parallel RandomX PoW pre-verification pool (CCheckQueue) run ahead of the serial
  connect; consensus-neutral (inline CheckRandomXSolution fallback still verifies
  anything not pre-verified). New -randomxverifythreads (default = -par).
- Adaptive dbcache: default sizes the UTXO/coins cache to most of RAM and shrinks
  under memory pressure, always leaving a reserve free; -dbcache pins a fixed value.
- P2P block download: bounded socket recv-drain loop (tlsmanager); frontier-block
  reassignment to break head-of-line stalls (-blockreassigntimeout); ProcessGetData
  serves a bounded batch of blocks per pass instead of one (fixes the serve-side
  one-block-per-tick throttle that caps download network-wide).
- assumeutxo: dumptxoutset RPC + LoadSnapshot machinery + AssumeutxoData chainparams.
- Signed bootstrap verification (util/bootstrap-dragonx.sh, util/sign-bootstrap.md).
- gtest: RandomX pre-verify consensus-equivalence test + UTXO-snapshot round-trip;
  revived the gtest harness (Makefile.am include fix, Makefile.gtest.include).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 12:30:10 -05:00
85c8d7f7dd Rebrand hush3 to DragonX and share RandomX dataset across mining threads
Minimal rebrand (see compliant-rebrand branch for full rebrand):
- Rename binaries: hushd/hush-cli/hush-tx → dragonxd/dragonx-cli/dragonx-tx
- Default to DRAGONX chain params without -ac_* flags (randomx, blocktime=36, private=1)
- Update configure.ac: AC_INIT([DragonX],[1.0.0])
- Update client version string and user-agent to /DragonX:1.0.0/
- Add chainparams.cpp with DRAGONX network parameters
- Update build.sh, miner.cpp, pow.cpp for DragonX
- Add bootstrap-dragonx.sh utility script
- Update .gitignore for release directory

Share single RandomX dataset across all mining threads:
- Add RandomXDatasetManager with readers-writer lock, reducing RAM from
  ~2GB per thread to ~2GB total plus ~2MB per thread for the VM scratchpad
- Add LogProcessMemory() diagnostic helper for Linux and Windows
2026-03-04 18:42:42 -06:00
Duke
f8136f5839 DragonX has left the nest 2026-02-28 12:12:45 -05:00
Duke
cb81fc3b95 Less noise unless -debug is used 2025-09-24 09:30:33 -04:00
Duke
2b3f9ed33f Add -ac_clearnet=0 option so an entire chain can disable clearnet connection, instead of -clearnet=0 which only applies to a single node 2025-08-08 16:09:32 -04:00
Duke
97470e385d Disallow using -mineraddress and -clearnet=0 at the same time 2025-06-27 05:45:24 -04:00
jhendrix
0339a6bb24 Clarify that it is a minimum fee per tx that uses OP_RETURN
Blocking point for merging https://git.hush.is/hush/hush3/pulls/460.
2025-05-16 15:53:53 -04:00
jhendrix
5d037f52ff Add HAC option -ac_minopreturnfee to change OP_RETURN fee per tx, regardless of tx size, default is 1 coin 2025-05-16 15:03:42 +01:00
Duke
d39503c13b Add HAC option to allow sending funds to the transparent burn address when -ac_private=1 2025-04-29 14:52:25 -04:00
Duke
be85be83db -clearnet implies -dns=0 -dnsseed=0 2025-03-07 09:15:12 -05:00
Duke
81be8caa3f Revert "Try to fix 'Failed to listen' error"
This reverts commit 11a9f95039.
2025-03-06 10:24:26 -05:00
Duke
11a9f95039 Try to fix 'Failed to listen' error 2025-03-04 12:05:09 -05:00
Duke
e5d85af092 Also set -bind=127.0.0.1 when -clearnet=0 2025-03-03 11:59:52 -05:00
Duke
d51c2ac20b Detect -clearnet correctly 2025-03-01 10:13:34 -05:00
Duke
cbc8995b36 -clearnet=0 2025-02-28 12:58:01 -05:00
Duke
b880801235 Move -disableipv4/-disableipv6 parsing to be after -onlynet parsing 2025-02-18 07:04:10 -05:00
Duke
44829674c8 Prevent the use of -disableipv4/-disableipv6 multiple times 2025-02-16 21:45:10 -05:00
Duke
53cf574c03 Use constants for the defaults of disableipv4/disableipv6 so the code and docs cannot be out of sync 2025-02-12 17:23:48 -05:00
Duke
85605737f0 Fix 'Not enough conversion specifiers in format string' 2025-02-12 17:13:46 -05:00
Duke
f98c34be1c Make -disableipv4/-disableipv6 do something useful 2025-02-12 13:38:53 -05:00
Duke
47cc49bcc5 Change OP_RETURN fee requirements
This commit removes the CLI option -opretmintxfee, makes it always
enabled, changes the required fee rate and changes which OP_RETURNS
get "amnesty" and do not need to pay this fee rate.
2024-09-27 09:09:31 -04:00
Duke
8d2380a31d Record value of DEBUG_LOCKORDER in debug.log 2024-06-09 12:10:59 -04:00
Duke
65c4c5c8de They are called Hush Arrakis Chains (HACs) now 2024-03-15 14:06:57 -04:00
onryo
58b65f9670 Update copyrights 2024-02-27 23:59:59 +01:00
Duke
f71f8124c3 Give a better error message which does not mention a specific coin name, so as to not confuse DragonX/etc users 2024-02-21 10:54:51 -05:00
Duke
a581f8fc8e Fix compile error and remove some cryptocondition dingleberries 2024-02-15 11:03:05 -05:00
Duke
e49836b45e Enforce sapling activation at height=1
We used to have the -ac_sapling option which defaulted to one, now we
enforce that it must always be one, it cannot be changed and is no
longer a CLI option.
2024-01-21 16:59:09 -05:00
Duke
c33bd61480 Fix typo in default clientname 2023-12-06 11:19:40 -05:00
Duke
37cff3924d Fix #346 2023-11-20 17:05:42 -08:00
Duke
f48181a120 Add help for -consolidationinterval which was missing 2023-10-25 13:16:47 -04:00
fekt
ac413ecb2e Adding Mac SDX paths 2023-03-03 20:20:47 -05:00
Duke
e033a2e6eb Update copyrights to 2023 2023-02-09 18:06:03 -05:00
duke
07505e311d Merge pull request 'correct ac_supply documented default' (#236) from jahway603 into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/236
2023-02-09 21:16:00 +00:00
zanzibar
512da314a5 BIP155 (addrv2)
Tor v3 + i2p
2023-01-06 15:23:22 +00:00
Duke
ae64eb2392 Remove alerts 2022-12-18 08:24:49 -08:00
Jonathan "Duke" Leto
fcfe09d196 chainActive.Tip() can be NULL if have never synced to a chain tip before, so use chainActive.Height() instead 2022-11-12 04:17:35 -08:00
jahway603
d5871b2090 correct ac_supply documented default 2022-11-06 21:02:33 -05:00
jahway603
202e67f9ac document -maxreorg argument 2022-11-01 14:25:12 -04:00
triplefive
70908b1009 document -maxdebugfilesize 2022-10-31 16:13:21 -04:00
fekt
e313676562 Mac build fixes 2022-10-27 16:49:02 -04:00
jahway603
30a1921e26 added -ac_randomx_interval and -ac_randomx_lag to hushd --help 2022-10-04 13:39:41 -04:00
Jonathan "Duke" Leto
5d2307a709 Update copyrights to 2022 2022-09-19 15:45:30 -07:00
Duke Leto
61999b89ed Merge pull request 'Implement zsweep' (#195) from zsweep into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/195
2022-09-17 02:16:05 +00:00