Commit Graph
371 Commits
Author SHA1 Message Date
DanSandClaude Opus 5.5 1faa349c27 gtest: check GetFilteredNotes and operation status against the old code
- test_wallet_scan_notes.cpp compares the new GetFilteredNotes with a
  verbatim copy of the original over a fabricated wallet: spending keys,
  diversified, unrecorded, ivk-only, fvk-only, mismatched and aliased
  addresses; spent, unspent, locked, conflicted and mempool notes at many
  depths; every filter/flag combination (about 1,400 calls), plus an
  encrypted and locked wallet. It also checks decrypt_with_pk_d against
  decrypt.
- test_operation_status.cpp compares z_getoperationstatus,
  z_getoperationresult and z_listoperationids with the original algorithm
  (up to 300 ops, same-second ties), shows the status calls finish while
  another thread holds cs_main and cs_wallet, and checks that concurrent
  pops hand each operation to exactly one caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:31:01 -05:00
DanSandClaude Opus 4.8 2d6359ea74 gtest: add job_id parser regression test for the 63-char abort fix
Covers b3e81f1ed: a 63-character mining.submit job_id containing any
non-hex byte must never complete to a 32-byte vector, so the EWBF
completion loop skips it instead of constructing uint256() (which
asserts vch.size()==32 and would abort the daemon from an
unauthenticated client).

Five cases pin the invariant using the real ParseHex/uint256 primitives:
all-spaces, a non-hex byte mid-string, and a non-hex byte at the end
never yield 32 bytes; a genuine 63-hex job_id completes to exactly 32
bytes for all 16 digits; plus ParseHex odd/even-length anchors. Wired
gtest/test_stratum_jobid.cpp into Makefile.gtest.include (5 tests, all
pass; full hush-gtest suite now 18/18).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PGhWvdBSgt6UxxHANr7gfN
2026-08-30 16:24:55 -05:00
DanSandClaude Opus 5 20b2cbe830 wallet: store the expanded BIP39 seed for mnemonic wallets
Mnemonic wallets stored the 32-byte BIP39 entropy as the HD seed and relied on
CHDChain.fMnemonicSeed to tell the deriver to expand it first. That flag is
version-gated in the CHDChain serialisation, so a binary that predates it reads
the record, never consumes the trailing byte, and derives from the raw entropy --
a different key tree, silently, with no error.

Store the expanded 64-byte BIP39 seed instead, with fMnemonic = false, and keep
the entropy in its own display-only record. Derivation then reads the stored
bytes directly on every binary, old or new, so key trees are identical and no
CHDChain version bump or minversion fence is needed. The wallet format stays
readable by earlier releases rather than becoming one-way.

Addresses are unchanged: the previous format expanded the entropy on every read
and fed the same 64 bytes to Master(). This is also the form the tree already
round-trips through -- z_exportwallet dumps the expanded seed, and restoring that
hex via -hdseed installs it with fMnemonic = false.

Write order is load-bearing: seed first, entropy second. A crash between them
leaves a wallet with a seed and no phrase, which is merely inconvenient. The
reverse would leave an entropy record with no seed, and the next start would mint
a different seed while the wallet still held a phrase for the old one.

-usemnemonic still defaults to false; only explicit opt-in and -mnemonic restores
take this path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 06:39:38 +02:00
DanSandClaude Opus 4.8 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
DanSandClaude Opus 4.8 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
DanSandClaude Opus 4.8 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
Duke 1001fa2e5d Remove some sprout-specific tests 2026-01-01 15:24:57 -05:00
onryo 58b65f9670 Update copyrights 2024-02-27 23:59:59 +01:00
Duke 19aa83ca80 You can now estimate future blocktimes of Arrakis Chains with: ./contrib/block_time.pl 5555555 DRAGONX 2023-12-27 12:53:07 -05:00
Duke e033a2e6eb Update copyrights to 2023 2023-02-09 18:06:03 -05:00
zanzibar 512da314a5 BIP155 (addrv2)
Tor v3 + i2p
2023-01-06 15:23:22 +00:00
Jonathan "Duke" Leto 5d2307a709 Update copyrights to 2022 2022-09-19 15:45:30 -07:00
Duke Leto 4a536d62dc Update copyrights 2021-04-17 13:03:22 -04:00
Duke Leto 980350b9b4 Stuck in the grind 2020-12-16 22:10:59 -05:00
Duke Leto b58c15b9fb update copyrights 2020-12-10 07:45:36 -05:00
Duke Leto a42c063b52 Remove more remnants of JoinSplits 2020-12-08 19:49:42 -05:00
Duke Leto be16f80abc Hush Full Node is now GPLv3
Any projects which want to use Hush code from now on will need to be licensed as
GPLv3 or we will send the lawyers: https://www.softwarefreedom.org/

Notably, Komodo (KMD) is licensed as GPLv2 and is no longer compatible to receive
code changes, without causing legal issues. MIT projects, such as Zcash, also cannot pull
in changes from the Hush Full Node without permission from The Hush Developers,
which may in some circumstances grant an MIT license on a case-by-case basis.
2020-10-21 07:28:10 -04:00
Duke Leto 920667dd73 Delete tests from ZEC that do not apply to us 2020-06-23 12:48:29 -04:00
Duke Leto f7b1c1f26f Delete Payment Disclosures
This code will be "experimental" forever, only supports Sprout, and
is a piece of shit. Deleting with fire.

Sapling viewing keys are the replacement, which already exist.
2020-06-05 07:20:38 -04:00
Duke Leto ed2c9450f9 desprout 2020-06-05 01:20:37 -04:00
Duke Leto 2134269e76 desprout 2020-06-03 00:12:54 -04:00
Duke Leto 62d438e0de desprout 2020-06-02 02:52:19 -04:00
Duke Leto 4d965f53eb A bunch more libsnark deletions/updates 2020-01-24 06:32:13 -05:00
Duke Leto 1c5e3e71b8 Clean up 2019-12-24 07:36:15 -05:00
Jonathan "Duke" Leto 7ca4e59831 Merge remote-tracking branch 'jl777/FSM' into duke
Conflicts:
	src/hushd
	src/komodo_bitcoind.h
2019-07-17 20:51:52 -07:00
jl777 52445b8430 Slowflag into CBOPRET if 2019-07-08 02:56:48 -11:00
Duke Leto f6a4f17f82 Avoid downloading the 700MB sprout-groth16 file we do not need 2019-07-05 01:19:02 -04:00
Bartlomiej Lisiecki 191fc2e152 Add support for importing and exporting sapling ivk 2019-04-22 17:22:31 -07:00
jl777 9a59f56135 https://github.com/zcash/zcash/pull/3670/files 2018-12-04 23:56:04 -11:00
miketout 99aeab28f9 Integrate latest Zcash fixes and update for non-latin user names 2018-10-27 20:29:03 -07:00
Jack Grigg ee3fa7020e Pass parameter paths as native strings to librustzcash 2018-10-27 19:19:02 +13:00
miketout 5f63373eb9 Selectively reject Sapling transactions while synced below activation height. Add separate control of staking. 2018-10-08 21:15:21 -07:00
miketout 8682e17a7d Sapling support for z_shieldcoinbase and more 2018-10-08 16:17:24 -07:00
Homu aede10d3c2 Auto merge of #3559 - str4d:3552-testnet-min-difficulty-blocks, r=bitcartel
Allow minimum-difficulty blocks on testnet

This is a consensus rule change on testnet that will result in a chain split (leaving the stuck chain, as desired).

Reverts #2766 and part of #1338.
Closes #3552.
2018-10-05 12:24:42 -07:00
miketout 3bfa5e2264 Latest Zcash updates and more CC for N@S 2018-10-05 00:26:06 -07:00
Jack Grigg 2b47b0de7d Position PoW.MinDifficultyRules test after rule activates 2018-10-05 00:10:17 +01:00
Homu 325ba00336 Auto merge of #3542 - Eirik0:3511-update-address-mapping, r=bitcartel
Add newly discovered sapling addresses to the wallet when decrypting

Closes #3511
2018-10-03 21:49:32 -07:00
Jack Grigg 1702a86455 Allow minimum-difficulty blocks on testnet and regtest
A block may be mined with nBits set to the minimum difficulty if its
nTime is set more than six block intervals (15 minutes) after its parent
block.

This is a consensus rule change on testnet that will result in a chain
split (as desired).
2018-10-03 17:50:17 +01:00
Jack Grigg 639e46b4d7 Revert "Remove testnet-only difficulty rules"
This reverts commit 333ea3c426.
2018-10-03 16:15:03 +01:00
miketout 4b729ec577 Changes for most chain power rule 2018-09-28 01:38:14 -07:00
Eirik Ogilvie-Wigley 83c4e360da Address need not be optional when adding sapling keys 2018-09-27 15:44:04 -06:00
Jack Grigg 34e222c18e Revert "Disable Sapling features on mainnet"
This reverts commit 554e00e8f9.
2018-09-21 23:43:31 +01:00
miketout 644c7445ec Latest Zcash updates 2018-09-20 13:32:57 -07:00
Homu 75c1dbc5eb Auto merge of #3452 - LarryRuane:3399-peer-ban-test, r=bitcartel
Test peer banning logic in both pre- and post-initial block download states

The DoS ban scores are different for each, and it's nice to test both.

Follow-on from #3410.
2018-09-19 10:25:23 -07:00
Homu 4fc1066b6f Auto merge of #3516 - str4d:3506-sendmany-sapling-t-ovk, r=ebfull
Generate an ovk to encrypt outCiphertext for t-addr senders

Closes #3506.
2018-09-18 18:10:52 -07:00
Jack Grigg bd3c860cb4 Use ovk directly in the TransactionBuilder API instead of fvk 2018-09-18 23:26:31 +01:00
miketout 9feb4b9e08 Major updates integration from all upstreams 2018-09-18 14:33:53 -07:00
Larry Ruane 6206d86237 Test peer banning logic in both pre- and post-initial block download states 2018-09-12 13:30:01 -06:00
Jack Grigg 07d3f947ec Extract a helper method for finding the next epoch 2018-09-12 10:07:44 +01:00
Homu 396bdaf00f Auto merge of #3307 - gtank:3187-refactor-checkblock, r=bitcartel
Refactor ContextualCheckBlock tests

This cleans up and condenses our quadratically-scaling transaction format / consensus rule tests. They still technically scale quadratically, but should be much more readable and manageable now - all that remains in the individual test cases is the specific version flag tweaking we're trying to test.

Closes #3187.
2018-09-11 14:53:59 -07:00