Commit Graph

2503 Commits

Author SHA1 Message Date
82d77344d2 Fix Sapling witness desync and parallelize witness cache rebuild
Wallets upgraded across the 1.0.1->1.0.2 network transition could end up
with note witnesses stuck at a stale height, causing z_sendmany /
z_mergetoaddress to fail to build a valid spend. Root cause was a trio of
issues that let a desynced witnessHeight perpetuate instead of self-healing:

- DecrementNoteWitnesses left witnessRootValidated and the witness deque in
  an asymmetric state on the size<=1 path.
- VerifyAndSetInitialWitness blindly trusted witnessHeight instead of
  validating the cached root against the chain, so a bad height survived.
- UpdatedNoteData copied witnessHeight even when no witnesses were present.
- witnessRootValidated was uninitialized and never serialized, so a garbage
  true value could short-circuit the self-heal.

Fixes:
- Default witnessRootValidated to false (in-memory only; never serialized).
- VerifyAndSetInitialWitness now validates the cached witness root against
  the block's hashFinalSaplingRoot and reseeds on mismatch.
- Symmetric reset of witness state in DecrementNoteWitnesses.
- Guard the witnessHeight copy in UpdatedNoteData behind a non-empty
  witnesses check.
- Defensive majority-root guard in GetSaplingNoteWitnesses.

Also rewrites BuildWitnessCache to rebuild the witness cache in parallel
(per-block commitment extraction + worker pool), cutting a full repair from
~28 min to ~2 min. Tunable via -witnessbuildthreads and -witnessfastrebuild;
output verified byte-identical to the serial path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 16:03:23 -05:00
M
d77088c1f2 Fix macOS Sequoia build with GCC 15 and update README
- Update compiler references from gcc-8 to gcc-15 across build system
  (build-mac.sh, darwin.mk, Makefile_custom)
- Use system Rust (rustup) instead of bundled Rust 1.32.0 for librustzcash
  to fix rlib linker incompatibility on macOS Sequoia
- Replace deprecated std::random_shuffle with std::shuffle (net.cpp,
  transaction_builder.cpp, wallet.cpp)
- Fix -std=gnu17 -> -std=gnu++17 for C++ targets (libzcash, libhush)
- Fix nodiscard warning in glibcxx_sanity.cpp
- Replace deprecated OSMemoryBarrier with std::atomic_thread_fence in LevelDB
- Add -Wno-error=deprecated-declarations to CXXFLAGS for third-party headers
- Fix REMAINING_ARGS unbound variable in build.sh
- Add --disable-tests handling to build-mac.sh
- Update README with correct macOS build dependencies and instructions
2026-03-19 09:30:50 -05:00
Duke
f8136f5839 DragonX has left the nest 2026-02-28 12:12:45 -05:00
duke
f26f27656a Set a mainnet donation zaddr for z_shieldcoinbase 2026-02-11 11:11:50 -05:00
Duke
874e89e4f0 Only validate donation zaddrs if donating 2025-12-25 12:08:06 -05:00
Duke
2fd88b65e3 Be clear that 0 and 10 are included as valid donation percentages 2025-12-25 12:07:59 -05:00
duke
529e76d01c Merge pull request 'Sync danger to dev' (#479) from danger into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/479
2025-12-25 12:02:58 -05:00
Duke
5ecd7629ec Make error message more general for any chain 2025-10-26 09:11:07 -04:00
Duke
9177a51b6d Remove getbalance64 #473 2025-10-16 11:14:01 -04:00
Duke
d206f28ae1 Update z_shieldcoinbase rpc docs 2025-10-16 01:10:46 -04:00
Duke
6435cd51a6 Use static_cast when calculating donation and add some debugging 2025-10-15 13:24:08 -04:00
Duke
42a676d277 Make the shieldcoinbase donation test pass 2025-10-14 12:20:35 -04:00
Duke
ebde772ada WIP donation test 2025-10-14 11:52:05 -04:00
Duke
606b28d6ca Improve rpc errors and docs 2025-10-14 11:00:08 -04:00
Duke
caf7178ffd Allow donation=0 2025-10-14 10:57:40 -04:00
Duke
c3b9b09144 Make rpc error correct for all chains 2025-10-14 03:58:00 -04:00
Duke
23ef00cfd7 WIP donation test 2025-10-13 18:21:51 -04:00
Duke
1f50e635a0 WIP donation 2025-10-13 15:27:30 -04:00
Duke
c078d1606d Merge remote-tracking branch 'origin/dev' into danger 2025-10-13 15:08:19 -04:00
Duke
02a26751bb WIP donation 2025-10-13 15:06:42 -04:00
Duke
cb81fc3b95 Less noise unless -debug is used 2025-09-24 09:30:33 -04:00
Duke
e421dfc6a5 Improve rpc docs of z_listlockunspent 2025-08-23 06:17:32 -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
7e3ce02d87 Bring back sorting notes descending by value which was in find_unspent_notes() 2025-08-22 06:16:25 -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
6e029a62ac Remove unused header inclusion 2025-08-21 16:14:23 -04:00
Duke
a719e05be4 Add output index to z_listlockunspent 2025-08-21 02:00:19 -04:00
Duke
7c434ba030 Log calls to GetFilteredNotes and only warn when witness root is actually invalid 2025-08-21 01:59:20 -04:00
Duke
b0cbcc6152 Unlock notes+utxos earlier 2025-08-21 01:57:42 -04:00
Duke
cae942a5c9 z_listlockunspent 2025-08-20 15:15:36 -04:00
Duke
c6892b950b Merge branch 'dev' into lockzins 2025-08-13 01:19:34 -04:00
Duke
5d31a77036 Do not throw exception during syncing on regtest 2025-08-12 23:57:27 -04:00
Duke
45f2e6b134 Remove unused code 2025-08-12 23:39:26 -04:00
Duke
0cd2bafa3a Remove unused CLI options and update debian example config 2025-08-12 13:37:44 -04:00
Duke
bd52fc5ee6 Try harder to avoid selecting locked notes to spend 2025-08-11 09:36:45 -04:00
Duke
62da1981bb WIP donation 2025-08-10 13:46:07 -04:00
Duke
d95da694b9 WIP donation via z_shieldcoinbase 2025-08-08 14:53:21 -04:00
Duke
d415277548 Merge branch 'dev' into lockzins 2025-07-29 09:10:42 -04:00
Duke
ab81589bdf Add rpc docs for using * with z_shieldcoinbase 2025-07-24 12:37:58 -04:00
Duke
7e63e2f013 We call them HACs now 2025-06-27 05:32:12 -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
b5db300aed Clean up some comments 2025-05-31 11:07:52 -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
46070c65fd Remove comment which is no longer correct, z_mergetoaddress has locked notes for a long time now 2025-05-30 13:56:38 -04:00
Duke
e38e10acdd Show a prefix of the first 8 chars of the hash for note debug lines 2025-05-30 09:54:44 -04:00
Duke
67dc93617c Merge branch 'dev' into lockzins 2025-05-30 08:41:30 -04:00
Duke
dba46b2ba6 Wait until after find_unspent_notes() to lock notes in z_sendmany 2025-05-30 08:40:42 -04:00