v1.0.6 — Two consensus fixes (mandatory soft fork)
This release adds two independent consensus rules, both activated by block
height at H = 1,739,500 (mandatory upgrade, coordinated ~2026-08-16). The
chain was audited beforehand: neither vulnerability shows any sign of prior
exploitation.
1. KAWPOW header-height consensus check (bad-blk-height)
Problem. CheckBlockHeader's checkpoint shortcut validates a KAWPOW block's
PoW using only the miner-supplied mix_hash (via GetHash()), and decides
whether to take that cheap path from block.nHeight — a field the miner
controls. A block mined above the last checkpoint can declare a height
below it, trigger the shortcut, and skip real memory-hard KAWPOW verification.
ContextualCheckBlockHeader never compared the declared height against the real
one (pindexPrev->nHeight + 1).
Fix.
- New consensus param nKAWPOWHeaderHeightCheckActivation.
- In ContextualCheckBlockHeader, reject with bad-blk-height (DoS 100) when a
KAWPOW header's declared nHeight differs from the contextual chain height, at
or after activation. Gated on the KAWPOW activation time so pre-KAWPOW headers
(which don't carry nHeight) are untouched. - Recovery for any node that already ingested a contaminated index:
LoadBlockIndexGuts skips entries whose reconstructed header fails PoW instead
of aborting; PruneBrokenBlockIndex drops placeholder entries and their
descendants; startup auto-rebuilds the chainstate (and wipes the derived
assets/assets/restricted DBs) when the coins DB is ahead of the index.
2. Asset transfer amount overflow / range check
Problem. Consensus::CheckTxAssets accumulates per-asset transfer amounts in
a signed int64 (CAmount) and only enforces totalInputs == totalOutputs.
Input amounts are unbounded and output amounts are bounded only from below
(> 0); nothing checks MAX_MONEY or guards the sum. Crafted amounts can
overflow the accumulator so the equality holds while individual outputs carry
huge values — i.e. asset inflation (matches the Ravencoin fix, commit
1ecb6598, which is already deployed on Ravencoin's network).
Fix.
- New consensus param nAssetTransferOverflowCheckActivation.
- CheckTxAssets takes a new bool fEnforceAssetOverflow and, when active,
validates each amount before mutating the accumulator using a checked sum
(amount < 0 || amount > MAX_MONEY || running > MAX_MONEY - amount). This
avoids both exceeding MAX_MONEY and any signed-int64 overflow (which would
be UB), unlike a MoneyRange() check performed after +=. - The gate is resolved by contextual height (no global flag): helper
IsAssetTransferOverflowActive(nHeight), computed by each caller —
pindex->nHeight in ConnectBlock, GetSpendHeight() in the mempool paths.
Activation & compatibility
- Both rules share height 1,739,500 on mainnet (testnet/regtest: 0).
- Recovery checkpoint retained at height 1,733,712.