Commit Graph
200 Commits
Author SHA1 Message Date
DanSandClaude Opus 4.8 81f803948c hygiene: Phase 6 (partial) — fix 7 verified bugs + quick-wins + dedup
From the Phase-6 structural scoping: land the verified behavioral bugs and
the safe quick-wins/dedups now; the large refactors (monolith splits, ~180
header globals) and consensus-adjacent items stay deferred. Built clean;
self-mined; verifychain=true.

BUGS (verified by reading the code):
- net.cpp CNode::Ban: a braceless `if (subNet.Match(...))` left
  `pnode->fDisconnect = true;` OUTSIDE the guard, so banning any one subnet
  marked EVERY connected peer for disconnect (dropped the whole peer set).
  Wrapped the two statements in braces. (LIVE, high severity.)
- rpcdump.cpp importwallet: the `!fGood -> throw "Error adding some keys"`
  check was trapped inside the `if (fRescan)` block, so importwallet with
  rescan=false silently reported success when key import failed. Hoisted the
  check before the rescan branch and cleaned the garbled braces/indentation.
- wallet.cpp CommitTransaction: ignored AddToWallet()'s return, so a failed
  disk-persist of a just-signed spend was swallowed while the tx broadcast.
  Now logs a hard error on failure.
- hush_nSPV_fullnode.h: the UTXOS branch declared `uint8_t filter` while the
  twin TXIDS branch uses `uint32_t filter`; dragon_rwnum switches on
  sizeof(filter), so the utxos path parsed only 1 of 4 wire filter bytes.
  Widened to uint32_t.
- asyncrpcoperation_sweep.cpp: LogPrintf("%s ... %s", one-arg) read a missing
  vararg; added the __func__ argument.
- rpcdump.cpp importprivkey: inner `auto secret_key` shadowed the outer
  uint8_t and changed the type into DecodeCustomSecret; dropped the shadow.
- rpcdump.cpp getrescaninfo: char[8] + sprintf("%.4f") overflows when the
  ratio >= 10.0 (transient reorg); widened to char[16] + snprintf.

QUICK WINS: removed the duplicate DRAGON_MAXSCRIPTSIZE #define; pinned the
dead HUSH3-branch NOTARISATION_SCAN_LIMIT_BLOCKS to 1440; fixed init typos
(fRequestShutdown, RPC warmup).

DEDUP: extracted the 19-line try/catch error-mapping block — copy-pasted
identically into all six async operations — into
AsyncRPCOperation::set_error_from_current_exception(), so the mapping is
edited in one place. Behavior-identical (verified all six blocks were byte-
identical first).

Deferred (endorsed by the scoping, better as their own PRs): addrman Select_
dedup, the pow.cpp powLimit helper (consensus file), the miner CreateNewBlock
lock-asymmetry, the wallet monolith splits, and the ~180-global / consensus-
retarget / Komodo-heritage work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-27 15:55:00 -05:00
DanSandClaude Opus 4.8 817c6b2d0e hygiene: Phase 5 — correct stale comments + name safe magic numbers
Fifth phase of the code-hygiene remediation, done per-file (18 files) via an
18-agent Workflow with strict guardrails. No consensus or security VALUES
changed (verified: pow/hush_utils/hush_bitcoind/net.h/crypter/stratum have
zero non-comment numeric changes); built clean, self-mined, verifychain=true.

Totals: 57 stale comments corrected, 46 user-facing branding fixes, 6
behavior-preserving named constants, 4 stratum warnings, 77 items deliberately
left (consensus/security values, copyright headers).

- Stale comments -> DragonX: corrected HUSH3/HUSH/Komodo/Equihash/Arrakis
  leftovers that misdescribed the active chain (pow AWT/lwma notes, txdb
  "Equihash solution" -> RandomX, wallet CLTV/overwinter/Sapling@1 notes,
  util datadir provenance, crypter's stale mapSproutSpendingKeys invariant).
  Replaced unprofessional/editorializing comments (profane TODOs, "developers
  are elite") with neutral technical notes, preserving the real design info.
- User-facing branding: dumpwallet header "created by Hush" -> "DragonX";
  RPC help text hushd/hush-cli/hushprivkey/hushaddress/Agama -> dragonx*;
  rebranded provably-dead "HUSH3" symbol-fallback literals to DRAGONX.
- Named constants (same values, non-consensus/non-security): addrman
  peer-selection factors (kChanceFactorGrowth/kChanceScale/deprioritize),
  sietch MIN_ZOUTS, an init notarization-DB cache size.
- Left the security macros (ECC/TFM_TIMING_RESISTANT=420, comment-clarified
  only), the consensus subsidy/commission literals + 128/129 TRANSITION
  (comment only), and copyright headers untouched.
- Added a prominent WARNING that the stratum server is Equihash-era and NOT
  updated for DragonX's RandomX PoW (flagged, not rewritten).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-27 15:19:22 -05:00
DanSandClaude Opus 4.8 0de30bbbd1 hygiene: Phase 3 follow-up — sweep commented-out debug cruft
Remove ~116 commented-out debug/dead-code lines the audit flagged as noise
(findings F6/F7/F15/F22): the Komodo "%s tikN" step-tracer comments and other
commented-out fprintf/printf/LogPrintf/std::cerr calls threaded through
AppInit2 (init.cpp), CreateNewBlock and the miner loops (miner.cpp), plus a
few commented-out dead-code fragments (sendmany SetLockTime/nLockTime, the
CCtx CC_vinselect random-pick block and AddNormalinputsLocal remote-mypk
redirect, miner adaptive-PoW assignments).

Comments only — no compiled behavior changes; the tree builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-27 13:25:17 -05: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
Duke cb81fc3b95 Less noise unless -debug is used 2025-09-24 09:30:33 -04:00
Duke 34829af017 Avoid coredump if witness index does not exist 2025-08-22 07:34:11 -04:00
Duke fb7d669f14 Remove commented out code 2025-08-22 07:09:15 -04:00
Duke ae170e9899 Spendable notes are now locked and 1159 seems to be an irrelevant upstream issue 2025-08-22 05:43:21 -04:00
Duke 90f00ac8a4 cleanup 2025-08-21 17:05:16 -04:00
Duke eb4fc52273 lockzins test finally passes because z_sendmany correctly locks notes now 2025-08-21 16:59:33 -04:00
Duke b0cbcc6152 Unlock notes+utxos earlier 2025-08-21 01:57:42 -04:00
Duke bd52fc5ee6 Try harder to avoid selecting locked notes to spend 2025-08-11 09:36:45 -04:00
Duke 007f2b31af Keep a list of notes we are spending and must lock which is different from the list of all notes we might spend 2025-05-31 12:21:17 -04:00
Duke 4fde93960b Upstream zec issue 1360 is mostly about sprout and sending to taddrs, which is not relevant 2025-05-31 10:09:24 -04:00
Duke dba46b2ba6 Wait until after find_unspent_notes() to lock notes in z_sendmany 2025-05-30 08:40:42 -04:00
Duke 88143a87fc Clean up locks if z_sendmany is cancelled 2025-05-30 08:22:31 -04:00
Duke b43a4f2653 Remove unused code and formatting 2025-05-30 08:22:16 -04:00
Duke 2bd3b510ed Also lock transparent input utxos in z_sendmany, like z_mergetoaddress already does 2025-05-19 08:56:53 -04:00
Duke 8980fceadf Add logging for the locking+unlocking of zins 2025-05-18 16:07:10 -04:00
Duke bd730cb927 Lock zins inside z_sendmany async operation 2025-05-18 14:52:51 -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 27db254d68 Sapling and Overwinter network upgrades are always active
These NU's are always active for Hush Arrakis Chains so this code only serves
to slow down all operations by constantly being checked. So we disable them
which will speed up syncing, mining and creating transactions.
2024-01-21 16:34:53 -05:00
Duke 8126e706c6 Optional OP_RETURN in z_sendmany 2023-03-24 16:20:17 -04:00
Duke e033a2e6eb Update copyrights to 2023 2023-02-09 18:06:03 -05:00
Jonathan "Duke" Leto 5d2307a709 Update copyrights to 2022 2022-09-19 15:45:30 -07:00
Duke Leto e1590836fd Use the correct variable for missing witness error 2022-09-16 23:17:08 -04:00
Jonathan "Duke" Leto 0938bd6b7b Log outpoint for failed Sapling witness lookup 2022-09-16 19:23:25 -07:00
Duke Leto 30001d4253 Comment out a z2z check that isn't quite correct 2021-08-22 17:34:44 -04:00
Duke Leto 4a536d62dc Update copyrights 2021-04-17 13:03:22 -04:00
Duke Leto e3a68dfdfb Hush is the extreme future, Komodo is the KYC past 2020-12-16 22:49:58 -05: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 c737c0dfaf We call them Hush Smart Chains around here 2020-11-15 11:54:06 -05:00
Duke Leto a23b0e8388 Remove the unsupported concept of staked notaries 2020-11-15 10:28:53 -05:00
Duke Leto d02fdd4fe5 I originally wrote this function and we call it Hush DPoW around here 2020-11-15 07:34:43 -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 10c5809877 More z_sendmany debugging when -zdebug enabled 2020-07-28 11:00:20 -04:00
Duke Leto b4e7f45826 Remove dead code 2020-07-28 00:44:57 -04:00
Duke Leto 79a4a48c38 Fix zaddr logging 2020-07-26 14:58:49 -04:00
Duke Leto f13171efc6 desprout 2020-06-06 05:14:21 -04:00
Duke Leto 22d4d1a06e desprout 2020-06-06 04:34:30 -04:00
Duke Leto 3cb215e39a more desprout, ugh 2020-06-05 12:17:41 -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 00bf3255eb desprout 2020-06-01 10:54:50 -04:00
Duke Leto 89bbd48eae More libsnark removal changes to various internals 2020-01-24 12:30:58 -05:00
Duke Leto 597171f2ee Forgotten %s 2019-12-31 10:52:11 -05:00
Duke Leto 252451e382 Add -zdebug to more stuff 2019-12-31 08:47:35 -05:00
Duke Leto a99b289c2a Add -zdebug 2019-12-30 23:00:06 -05:00
Duke Leto ace213c54f This actually has pretty decent logging for when nullifiers are added 2019-12-30 07:14:46 -05:00