Review report

bitcoin/bitcoin: PR #35861

1 minor finding · 7 suggestions

Earlier concerns neither republished nor resolved: 1 minor finding. See the Run archive for their assessments.

Findings

Link

[minor] · The socket cap shortens unlimited CLI receive waits to 24.8 days

A TCP bitcoin-cli request with -rpcclienttimeout=0 now reports a connection timeout after one response-free wait of about 24.8 days, despite its five-year internal deadline.

Location: src/util/sock.cpp:168 (head).

Details and suggested fix

HTTPClient::Recv passes the remaining request time to Sock::Wait, then throws CConnectionFailed{"timeout"} if no receive event occurs. It does not distinguish expiry of the new INT_MAX-millisecond cap from expiry of the request deadline. This affects a single receive wait longer than 24.8 days, such as waitforblockheight on a stalled network; the user can reissue the RPC. Keep the syscall-safe cap, but repeat an empty capped wait while the original deadline remains in the future. At base, narrowing the five-year value gave Linux/poll a negative, indefinite timeout. The cap does fix the immediate macOS/select failure, so removing it is not sufficient. No observed occurrence was identified.


Optional improvements

Link

[suggestion] · Chainparams sanity checks miss the placeholder genesis proof of work

The new Testnet5 sanity case checks genesis identity and target encoding, but would not detect shipping the current genesis hash above its target.

Location: src/kernel/chainparams.cpp:546 (head).

Details and suggested fix

The unmined genesis is expected in this draft, but its asserted e9a8fd2b… hash exceeds the 0x1a0fffff target. sanity_check_chainparams checks only hash identity, target encoding, and parameter bounds, so its Testnet5 case does not detect this. Disk block reads and index loading do enforce proof of work. Add BOOST_CHECK(CheckProofOfWork(genesis.GetHash(), genesis.nBits, consensus)) to the shared helper as a launch guard. It would expose the placeholder until a mined genesis replaces it; any temporary expected failure should remain explicit while the branch is WIP.


Link

[suggestion] · The Testnet5 release note omits mandatory mining requirements

Testnet5's activation settings require GBT clients to request consensuscleanup and construct timelocked coinbases, but the release note explains neither requirement.

Location: doc/release-notes-testnet5.md:7 (head).

Details and suggested fix

ALWAYS_ACTIVE makes GBTStatus list consensuscleanup as a mandatory active rule from the first template. A client requesting only ["segwit"] receives Support for 'consensuscleanup' rule requires explicit client support. Miners constructing their own coinbase must also set nLockTime = height - 1 and a non-final nSequence, or their blocks are invalid with bad-cb-locktime or bad-cb-sequence. Document both requirements here for external pool operators. Compatibility of the planned ckpool endpoint has not been confirmed.


Link

[suggestion] · BIP54 enforcement probes skip the activation boundary

The functional test mines the first active block with compliant transactions, so a validation gate that starts one block late would escape its rejection assertions.

Location: test/functional/feature_bip54.py:395 (head).

Details and suggested fix

generate_bulk(node, 144) mines through the first ACTIVE block using compliant coinbases. The subsequent status assertion checks deployment reporting, while violating blocks are submitted only afterwards. Stop before the boundary and accept a distinguishing violation, such as an incorrectly timelocked coinbase, at the last inactive height. Reject that violation at the first active height, then accept a compliant replacement. A rollback below activation followed by the inactive acceptance check would also protect the reverse transition.


Link

[suggestion] · Per-network documentation and coverage still omit Testnet5

The new chain is absent from the example-configuration section generator, datadir table, and existing network-specific test lists.

Location: src/chainparamsbase.cpp:22 (head).

Details and suggested fix

Add a [testnet5] footer section to gen-bitcoin-conf.sh and a testnet5/ row to doc/files.md. The help-derived option entry does not supply that configuration section. Also exercise MAGIC_BYTES["testnet5"] in feature_assumeutxo.py's mismatching-network cases. Once genesis is finalized, extend feature_config_args.py's -acceptstalefeeestimates rejection loop to Testnet5 as well. Deferring the exact getchainparams-testnet5.json fixture until then is reasonable.


Link

[suggestion] · BIP54 sigops fuzzing does not check acceptance results

The fuzz target discards CheckSigopsBIP54's result, so generated cases cannot detect incorrect accept/reject decisions unless they also trigger a crash or internal assertion.

Location: src/test/fuzz/bip54.cpp:53 (head).

Details and suggested fix

An implementation that always returns true would not fail any semantic assertion in bip54_sigops. Keep the arbitrary-script exercise, but add an oracle for a constrained subset with independently known counts. For example, generate push-only scriptSigs and bare or P2SH scripts containing known numbers of OP_CHECKSIG and OP_CHECKMULTISIG operations with explicit key counts. Sum the expected accurate count without calling the accounting implementation, then assert result == (total <= MAX_TX_BIP54_SIGOPS). Boundary seeds should exercise both outcomes.


Link

[suggestion] · The Tor backoff assertion can reject a correctly timed reconnect

The negative observation window starts after the disconnect trigger, so a delayed test thread can fail on a reconnect that respected the one-second backoff.

Location: test/functional/feature_torcontrol.py:135 (head).

Details and suggested fix

expect_disconnect starts its 0.5-second ensure_for only after the trigger body returns. Meanwhile, the mock's separate thread keeps recording commands. If the foreground thread is descheduled until a correct reconnect occurs, its next predicate check sees the new PROTOCOLINFO 1 and fails. The shared helper exposes the oversized-line and overmany-lines cases to the same scheduling dependency. Record monotonic timestamps in the mock, timestamp the trigger before sending it, and compare the reconnect arrival against that trigger instead of starting a fresh negative window afterwards.


Link

[suggestion] · An unused tx_verify.h include remains after the BIP54 move

policy.cpp retains the newly added transaction-validation header after its only intended caller was removed.

Location: src/policy/policy.cpp:13 (head).

Details and suggested fix

The move commit added consensus/tx_verify.h for the call to Consensus::CheckSigopsBIP54. The following change removes that call from ValidateInputsStandardness, and no remaining code in policy.cpp uses a declaration from the header. Remove the include to avoid retaining the unnecessary build dependency.


Backport verdict: Needs clarification

Every inherited 32.x backport that could be compared matches its upstream original apart from the Github-Pull/Rebased-From trailers. Completeness cannot be confirmed: the packet has no original-commit inventories, many original patches are omitted, and #36336 is explicitly a partial backport with the left-out commits unlisted. The BIP54 (#35793) and Testnet5 commits carry no Rebased-From trailers. The target branch is also unresolved: the head is v32.1 plus #35793 plus Testnet5, while the base is master 32.99, and bips.md says v33.0.

Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.