Review report

bitcoin/bitcoin: PR #36167

1 minor finding · 4 suggestions

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

Findings

Link

[minor] · Unused-parameter warnings remain disabled after the cleanup

Adding -Wunused does not strengthen the configured GCC/Clang diagnostics, and the retained -Wno-unused-parameter leaves the parameter cleanup unenforced.

Location: CMakeLists.txt:491 (head).

Details and suggested fix

The warning interface already enables -Wall and -Wextra; GCC and Clang include the -Wunused group in -Wall. The existing specific unused-warning flags also predate this PR, including -Wunused-const-variable. More importantly, the later IF_CHECK_PASSED block appends -Wno-unused-parameter to the actual target options, so new unused parameters remain undiagnosed in core code and the leveldb/minisketch targets that consume core_interface. Remove that suppression to enforce the parameter cleanup, and drop the redundant -Wunused addition. If parameter warnings are intentionally to remain disabled, omit the parameter-only cleanup rather than presenting this build change as enforcement.


Optional improvements

Link

[suggestion] · The RPC helper refactor changes numeric boundary behavior

generatetoaddress changes its accepted maxtries range, while walletcreatefundedpsbt changes the error for psbt_version=-1, despite the refactor's no-behavior-change description.

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

Details and suggested fix

Previously, explicit maxtries passed through getInt<int>(): -1 became UINT64_MAX on conversion, while values above INT_MAX failed. Arg<uint64_t> instead uses unsigned std::from_chars parsing, rejecting negative inputs and accepting positive integers through UINT64_MAX. This matches generatetodescriptor and may be preferable, but it changes the contract. Similarly, once funding succeeds, walletcreatefundedpsbt now reports “JSON integer out of range” for psbt_version=-1 instead of RPC_INVALID_PARAMETER “The PSBT version can only be 2 or 0”; accepted versions remain 0 and 2. Separate these parsing changes from the behavior-preserving refactor and add boundary tests. For maxtries, a valid address with nblocks=0 exercises parsing without mining. No in-tree caller supplying these boundary values was found, so practical impact remains unconfirmed.


Link

[suggestion] · Name removal leaves removable dead parameters in internal APIs

Suppressing warnings for internal parameters that are always unused retains misleading interfaces and, in the GUI caller, unnecessary fee-string formatting.

Location: src/wallet/wallet.cpp:3042 (head).

Details and suggested fix

Unnamed parameters suit overrides and callbacks with fixed signatures, but these internal APIs can be simplified instead. AttachChain never populates warnings, although its declaration and both callers still expose that output. AppInitBasicSetup uses neither input in any build configuration. processSendCoinsReturn ignores msgArg, yet PrepareSendText formats a fee string just to pass it. Remove these dead parameters and their corresponding arguments rather than hiding them from future unused-parameter diagnostics, either here or in explicit follow-ups. These leftovers predate the PR and behavior is unchanged. Keep genuinely shared construction signatures separate: removing TestChain100Setup's ignored chain_type also requires adapting MakeNoLogFileContext<T>, which constructs fixtures as T(chain_type, opts).


Link

[suggestion] · The alias test does not cover rejection of the legacy lookup

The unit test verifies first-name lookup but would still pass if Arg also accepted legacy_def_bool.

Location: src/test/rpc_tests.cpp:650 (head).

Details and suggested fix

Changing the fixture to def_bool|legacy_def_bool establishes that Arg<bool>("def_bool") works, including default handling. Neither invocation looks up the second name, so the test does not establish the commit message's claim that the legacy alias is ignored. Add a BOOST_CHECK_THROW(self.Arg<bool>("legacy_def_bool"), NonFatalCheckError) assertion inside check_positional, scoped with test_only_CheckFailuresAreExceptionsNotAborts as in the nearby negative tests so debug builds throw rather than abort.


Link

[suggestion] · std::distance loses its direct <iterator> include

Replacing <iterator> with <ranges> leaves std::distance supplied indirectly, contrary to the repository's direct-include convention.

Location: src/rpc/util.cpp:34 (head).

Details and suggested fix

GetParamIndex still calls std::distance, which belongs to <iterator>. The new std::ranges::find_if belongs to <algorithm>, already included here, and does not require replacing <iterator> with <ranges>. Restore <iterator> and remove the unnecessary <ranges> include. This follows the developer notes' direct-include rule; rpc/*.cpp also belongs to CI's enforced IWYU set, although the IWYU job was not run.


Coverage details

Earlier concerns

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