Commit Graph
104 Commits
Author SHA1 Message Date
DanSandClaude Opus 4.8 798eccc624 hygiene: fix seven latent defects from the v1.2.0 code audit
Phase 1 of the code-hygiene remediation. Each is a genuine defect, not
style. The two consensus functions are touched only by provably
behavior-preserving dead-code removal and a comment.

- miner: initialize the anti-spin loop counter (was `int i;` -- the loop
  condition read an indeterminate value, UB) and break once the block
  time advances past the median, which is what the comment intended.
- consensus/upgrades: drop a stray printf() on the NetworkUpgradeState
  path; the following assert already documents the invariant.
- txdb: CBlockTreeDB::Snapshot2's outer catch treated ANY exception as
  normal end-of-iteration and built a snapshot from partial data. Fail
  instead, matching the inner catch the author marked consensus-relevant
  ("we need to exit here if so for consensus code!"). iter->Valid()
  already handles genuine end-of-iteration.
- wallet/rpcwallet + init: -sietch-min-zouts used a "--" key that the arg
  parser (which normalizes --foo to -foo) can never match, so the Sietch
  decoy floor was silently stuck at the default. Use the single-dash key
  so the knob works, and document it in -help.
- hush_bitcoind + hush_utils: remove four unreachable duplicate `else if`
  branches from hush_commission()/hush_block_subsidy() (a second
  `height < 23860000` and a second `height < 27220000` in each). Proven
  identical across 49,591 heights. NB: the dead values hint at an intended
  clean halving schedule that was never wired up; the DEPLOYED schedule
  (two double-steps) is preserved exactly. Changing it is a future
  consensus decision, not this cleanup.
- hush_bitcoind: replace the "likely a bug" halving TODO with an accurate
  note -- INTERVAL is only consumed by a debug fprintf, so the > vs >=
  boundary at HALVING1 has no consensus effect.
- git rm two committed macOS build artifacts (cc/customcc.dylib and
  libcc.dylib) and add the missing .dylib .gitignore rules.

Built clean on Linux; an isolated node self-mined genesis->5113 exercising
the miner and consensus-subsidy paths, and getsnapshot returned normally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-27 11:35:38 -05:00
onryo 58b65f9670 Update copyrights 2024-02-27 23:59:59 +01:00
Duke 14d3ae1785 Reject ztxs with duplicate zkproofs
This is a greatly simplified and slightly tweaked version of
https://github.com/PirateNetwork/pirate/commit/af2e3713e286d61353edffd0b4c89c931b455cb4

Their version will detect duplicate zkproofs across transactions while
this code will only detect duplicate zkproofs in a single ztx. If dupes
are found, the tx will be denied entry into the mempool.

This provides most of the benefit (increased CPU cost to attackers) with the
least code change and no annoyance to full node operators. Detecting
duplicate zkproofs across transactions requires a one-time reindex of
all of history, which means significant downtime for nodes.

Since Hush + HSCs have a much more strict policy on number of shielded
outputs and shielded inputs, only detecting duplicate zkproofs in
individual ztxs seems sufficient for now.

No correctly functioning node or wallet will ever create duplicate
zkproofs, so there is no worry of this accidentally affecting normal
users. Currently this is not a consensus rule but it could become one
in the future.
2023-10-13 04:31:41 -07:00
Duke e033a2e6eb Update copyrights to 2023 2023-02-09 18:06:03 -05:00
Jonathan "Duke" Leto 03e1308783 Add copyright to files missing Hush copyright lines 2022-09-21 08:50:10 -07:00
Jonathan "Duke" Leto 5d2307a709 Update copyrights to 2022 2022-09-19 15:45:30 -07:00
Duke Leto c6e5b07a59 You might be a king or a little street zsweeper, but sooner or later you will dance with the reaper 2022-08-24 23:38:19 -04:00
Duke Leto 4a536d62dc Update copyrights 2021-04-17 13:03:22 -04:00
Duke Leto 7aacd3dfce Merge branch 'syncbug' into dev
Conflicts:
	src/metrics.cpp
2020-12-11 00:35:14 -05:00
Duke Leto 5b07e01437 Various things 2020-12-11 00:33:56 -05:00
Duke Leto b58c15b9fb update copyrights 2020-12-10 07:45:36 -05:00
Duke Leto 31fc4099df HUSH NSPV 2020-12-09 19:22:51 -05:00
Duke Leto 65cdf6dd32 Update some links shown by some RPCs 2020-12-05 08:02:31 -05:00
Duke Leto 8a5130713d Hush them headers 2020-12-04 09:49:56 -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 a7f88a87aa Update copyright URL to be https 2020-09-20 13:17:38 -04:00
Duke Leto 40f0745fab Track shielded spends on disk so we can calculate anonset in real-time correctly 2020-07-11 11:11:14 -04:00
Duke Leto 86a98587a1 desprout 2020-06-05 10:14:52 -04:00
Mihailo Milenkovic a7204d9f85 CC fixes for nSPV and others (#30)
- Remove adding txfee inputs for gateways claim
- FULLNODE and SUPERLITE macros
- Filter SetCCtxids with txid from oprert
- Fix for nServices of fullnode
- Use SetCCtxids_nSPV for some more CCs
- Fix addnormalinputs and add checking if utxo spent in mempool
2019-08-12 14:16:46 +03:00
jl777 0454333ff8 Tristate KOMODO_NSPV 2019-07-30 05:11:57 -11:00
jl777 8910b7c56f #define NSPV_BRANCHID 0x76b809bb 2019-07-12 01:01:32 -11:00
jl777 c9ec6d961d Include 2019-07-12 01:00:10 -11:00
jl777 80fd6fee58 mtx.fOverwintered = true; mtx.nExpiryHeight = 0; mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID; mtx.nVersion = SAPLING_TX_VERSION; 2019-07-12 00:58:31 -11:00
jl777 e4791f54e6 Merge branch 'FSM' into patch-gcc-8 2019-01-25 16:33:13 -11:00
DeckerSU a6e7da55e2 fix gcc-8 / g++-8 build 2019-01-26 03:09:54 +03:00
jl777 0ea9ae3c05 Update copyright to 2019 2018-12-31 21:41:05 -11:00
jl777 91f355fd69 4MB block size with sapling 2018-11-24 08:39:23 -11:00
jl777 13b038a9b9 maxinputs+1 2018-11-21 01:36:32 -11:00
miketout 1021455845 Fix negative height issues for pruning cheat lists 2018-10-11 14:23:14 -07:00
miketout 8682e17a7d Sapling support for z_shieldcoinbase and more 2018-10-08 16:17:24 -07:00
Jack Grigg 1f7ee4af70 Rename min-difficulty flag to remove off-by-one in the name 2018-10-04 23:26:05 +01:00
Jack Grigg b86dc98047 Only enable min-difficulty blocks on testnet from a particular height
The min-difficulty change is a bilateral consensus rule change, and so
must be conditionally enabled in order for the earlier section of the
chain to synchronise.

Technically this could be implemented as a network upgrade, but as this will
never be deployed to mainnet, a targeted fork will suffice.
2018-10-04 14:05:27 +01:00
Jack Grigg 5ead4b1713 Revert "Get rid of consensus.fPowAllowMinDifficultyBlocks."
This reverts commit dffc025d38.
2018-10-03 16:08:00 +01:00
miketout 4b729ec577 Changes for most chain power rule 2018-09-28 01:38:14 -07:00
miketout 644c7445ec Latest Zcash updates 2018-09-20 13:32:57 -07:00
Homu 36243f41f1 Auto merge of #3520 - Eirik0:3327-sign-offline, r=bitcartel
Fix signing raw transactions with unsynced offline nodes

This PR address the issue in two different ways:

- In `signrawtransaction` we determine the consensus branch ID (which we then later use to construct the transaction) using the chain height. We now also consider the `APPROX_RELEASE_HEIGHT` as this is a better estimation than 0 for the height of the chain if we are unsynced. (This in and of itself solves the Overwinter signing issue).
- We have added an additional parameter to `signrawtransaction` to allow manually overriding the consensus branch ID that zcashd determines we are on. This allows users to work around corner cases where the first strategy is still insufficient.

Closes #3327.
2018-09-19 15:02:52 -07:00
miketout 9feb4b9e08 Major updates integration from all upstreams 2018-09-18 14:33:53 -07:00
Eirik Ogilvie-Wigley 36a490677c Allow passing branchId when calling signrawtransaction 2018-09-17 10:27:39 -06:00
Jack Grigg 07d3f947ec Extract a helper method for finding the next epoch 2018-09-12 10:07:44 +01:00
Gregory Maxwell e41632c9fb IBD check uses minimumchain work instead of checkpoints.
This introduces a 'minimum chain work' chainparam which is intended
 to be the known amount of work in the chain for the network at the
 time of software release.  If you don't have this much work, you're
 not yet caught up.

This is used instead of the count of blocks test from checkpoints.

This criteria is trivial to keep updated as there is no element of
subjectivity, trust, or position dependence to it. It is also a more
reliable metric of sync status than a block count.
2018-05-15 21:25:19 +12:00
Michael Toutonghi 1f722359c1 Verus Proof of Stake Compete with Additional ant-fork protection on block 1 2018-05-13 18:59:06 -07:00
miketout 1234f16b15 Fix to separate minimum difficulties for primary and alternate algorithms 2018-05-05 16:34:05 -07:00
Jack Grigg 25fee3509a Rename MAX_TX_SIZE to MAX_TX_SIZE_AFTER_SAPLING 2018-05-04 11:17:30 +01:00
Jack Grigg 15ec5525e3 Raise 100kB transaction size limit from Sapling activation
Closes #2864.
2018-05-04 11:17:30 +01:00
miketout 48d800c2c6 Merge all Komodo changes, including proof of stake, crypto conditions, passport, etc. 2018-05-02 03:24:21 -07:00
miketout 2910478b5a Added LWMA difficulty algorithm for Verus, enabled compiler optimizations for verushash 2018-04-29 23:21:35 -07:00
jl777 9d65762061 Test 2018-04-25 18:52:27 +03:00
jl777 efee0b0e9d Fix 700kb limit 2018-04-25 18:50:55 +03:00
Jack Grigg 987b8ee60e Adjust consensus rules to require v4 transactions from Sapling activation 2018-04-19 05:01:47 +01:00
Jack Grigg 176fada24d Add Sapling to upgrade list 2018-04-12 12:13:05 -06:00