3 suggestions
Optional improvements
[suggestion] · Client-visible RPC error-code changes have no release note
Clients that branch on numeric RPC error codes will see changed responses for several failing requests after upgrading, but the PR adds no release note.
Location: src/univalue/include/univalue.h:150 (head).
Details and suggested fix
Add an RPC release note, for example doc/release-notes-36826.md, listing the old and new codes:
- Numeric conversion failures reported as
JSON integer out of rangeorJSON double out of rangechange from-1to-3when the getter exception reachesExecuteCommand. Examples includelisttransactionscount/skip,bumpfee'soriginal_change_index, andaddpeeraddressport. - Disabled fee estimation, including
estimatesmartfeeunder-blocksonly, andgettxoutsetinforequests for an explicit block above a still-syncing coinstatsindex change from-32603to-1. - Invalid
addnode/setbancommands and out-of-rangemockschedulerdeltas change from-1to-8.
doc/developer-notes.md calls for release notes on API changes, and the 22.0 notes document similar error-code corrections. The generic std::exception fallback remains unchanged and needs no entry.
[suggestion] · The new internal-error rule excludes reachable, tested failures
The new “unreachable internal errors” rule conflicts with the pre-existing loadtxoutset precondition errors and its own datadir-corruption example.
Location: src/rpc/protocol.h:60 (head).
Details and suggested fix
loadtxoutset maps every failed ActivateSnapshot result to RPC_INTERNAL_ERROR, including a nonempty mempool or a base header that has not synced yet. feature_assumeutxo.py explicitly expects -32603 for these ordinary precondition failures. Separately, rpc_blockchain.py models missing undo data by moving rev00000.dat and expects the same code, illustrating why the corruption example is not literally unreachable. Prefer wording such as “unexpected internal failures, such as failed invariants or datadir corruption” instead of “unreachable internal errors”. The snapshot precondition classifications can be corrected separately if they should follow the transient/user-configuration rule; that would be another client-visible response change.
[suggestion] · Several changed error classifications lack targeted assertions
Tests do not pin the changed classifications for invalid setban commands, out-of-range mockscheduler deltas, double overflow, or the coinstatsindex syncing error.
Location: src/rpc/net.cpp:824 (head).
Details and suggested fix
The existing setban functional cases use valid add/remove commands, and the C++ CallRPC helper retains only the error message. Existing mockscheduler callers use valid deltas, and the UniValue tests check successful get_real conversions rather than overflow. Add RPC assertions for -8 with an invalid setban command and with mockscheduler(0)/mockscheduler(3601). Also add BOOST_CHECK_THROW(v.get_real(), UniValue::type_error) after setting v to 1e400 in src/univalue/test/object.cpp. These tests would distinguish the new classifications from the old ones. The coinstatsindex branch requires an unsynced index plus an explicit block above its indexed height; the restart/reorg test passes no explicit block. That case can reasonably remain untested if arranging it deterministically is too costly.