Review report

bitcoin/bitcoin: PR #36384

1 suggestion

Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · The new generatetoaddress maxtries range lacks regression coverage

The existing tests would not detect reverting generatetoaddress from unsigned 64-bit maxtries parsing to the old signed-int parser.

Location: src/rpc/mining.cpp:317 (head).

Details and suggested fix

The old getInt<int>() rejected values above INT_MAX, while parsing -1 and assigning it to uint64_t produced UINT64_MAX. Arg<uint64_t> now accepts the full unsigned range and rejects negatives. test_generatetoaddress never supplies maxtries, and the CLI, conversion and helper tests use small values, so reverting this call site's parser would not fail those assertions. Extend test_generatetoaddress with its valid address and nblocks=0: assert that maxtries=2**31 and 2**64-1 return [], while -1 and 2**64 fail with assert_raises_rpc_error(-1, "JSON integer out of range", ...). The handler still parses maxtries, but generateBlocks skips its loop, so these cases perform no proof-of-work. No current caller passing a negative or above-INT_MAX maxtries was found.


Coverage details

Earlier concerns

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