rpc: fix getorphantxs verbosity help and type checking

bitcoin/bitcoin: PR #36979

1 suggestion

Optional improvements

Link

[suggestion] · Corrected getorphantxs help headings lack regression coverage

The existing getorphantxs help check would still pass if the corrected verbosity headings reverted to the misleading verbose spelling.

Location: src/rpc/mempool.cpp:1305 (head).

Details and suggested fix

test_misc already calls node.help("getorphantxs"), but only checks that it does not contain unknown command: getorphantxs. RPCResults::ToDescriptionString prints each condition as Result (<condition>):, so restoring the old conditions would again advertise verbose instead of the declared verbosity argument without failing this check. Store the method-specific help output and assert that it contains Result (for verbosity = N): for each of 0, 1 and 2, and does not contain for verbose =. This adds regression coverage for the help correction without changing RPC behavior.


Coverage details

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Rejecting boolean verbosity in getorphantxs was deliberate, not an accidental departure from getblock/getrawtransaction. Historical PR #31043 explicitly introduced that rejection and developer guidance. The pinned guidance says integer verbosity permits multiple levels and that new RPCs should prevent undocumented boolean verbosity.

The compatibility boundary is between preserving historical boolean interfaces and avoiding that legacy interface in new methods. Standardizing getorphantxs type checking does not require extending boolean compatibility to it: both the base and head reject booleans.

Source 1 · Source 2

Ralph's inferences

The reason to retain boolean verbosity for legacy RPCs is to preserve callers' existing input semantics while allowing the interface to grow beyond two output modes. The guidelines explicitly grandfather bool-to-multivalue transitions and require false to map to 0 and true to 1; they otherwise discourage argument-type overloading because it can surprise users and complicate command-line use.

This explains the compatibility exception described for getblock/getrawtransaction: preserve established accepted inputs and their meanings without making boolean acceptance a requirement for newer verbosity arguments. The original discussions for those two RPCs remain unverified.

The inspected boolean-compatibility commitment does not itself establish a commitment to the exact getorphantxs rejection message. The historical follow-up specifies rejection of booleans, while the custom wording appears in the shared parser implementation; no inspected discussion promises that wording to clients.

Moving getorphantxs from its explicit rejecting parser call to its declared numeric schema preserves the historically intended accepted-input boundary. Replacing the custom wording with an argument-specific type error is a separate error-contract question. The evidence supports distinguishing those questions, but does not establish a universal permission to change RPC error text or an independent guarantee of error-code stability.

Source 1