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>
This commit is contained in:
+4
-4
@@ -1564,14 +1564,14 @@ uint64_t hush_block_subsidy(int height)
|
||||
subsidy = 549316;
|
||||
} else if (height < 23860000) {
|
||||
subsidy = 274658;
|
||||
} else if (height < 23860000) {
|
||||
subsidy = 137329;
|
||||
// removed unreachable duplicate `height < 23860000` (=> 137329); kept in sync
|
||||
// with hush_commission() — the schedule drops straight to 68664 next.
|
||||
} else if (height < 25540000) {
|
||||
subsidy = 68664;
|
||||
} else if (height < 27220000) {
|
||||
subsidy = 34332;
|
||||
} else if (height < 27220000) {
|
||||
subsidy = 17166;
|
||||
// removed unreachable duplicate `height < 27220000` (=> 17166); kept in sync
|
||||
// with hush_commission() — the schedule drops straight to 8583 next.
|
||||
} else if (height < 28900000) {
|
||||
subsidy = 8583;
|
||||
} else if (height < 30580000) {
|
||||
|
||||
Reference in New Issue
Block a user