rpc: fix `getorphantxs` verbosity help and type checking #36979

pull l0rinc wants to merge 4 commits into bitcoin:master from l0rinc:l0rinc/getorphantxs-verbosity-help changing 8 files +22 −34
  1. l0rinc commented at 1:01 PM on November 25, 2026: contributor

    Problem: #31043 removed the verbose alias from getorphantxs, but all three result headings in its help still use that name. Passing verbose=1 as the help suggests returns Unknown named parameter verbose. The RPC also bypasses the schema’s numeric type check and reports a custom error for boolean inputs.

    Fix: Use verbosity in all three result headings. Let the RPC schema check the argument type and supply its declared default of 0. For boolean inputs, the RPC still returns error -3, now with the standard message identifying the argument by name and position.

  2. DrahtBot added the label Docs on Nov 25, 2026
  3. DrahtBot commented at 1:02 PM on November 25, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36990 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36990.svg"></sub> (test: replace hard-coded RPC error codes by l0rinc)
    • #33741 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/33741.svg"></sub> (rpc: Optionally print feerates in sat/vb by polespinasa)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. rpc: use verbosity in getorphantxs result headings
    The headings still refer to the removed `verbose` alias, so following the help and passing `verbose=1` returns `Unknown named parameter verbose`.
    cfd652ae52
  5. in src/rpc/mempool.cpp:1303 in 48beca0ffa
    1302 | @@ -1303,17 +1303,17 @@ static RPCMethod getorphantxs()
    1303 |               RPCArgOptions{.skip_type_check = true}},
    


    maflcko commented at 1:33 PM on November 25, 2026:

    I don't like skipping type checks, especially when there is a schema now. The schema or the server should take care of all of this, not each rpc method by itself.

    Can you drop this?

    diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
    index 792023d..85e990e 100644
    --- a/src/rpc/mempool.cpp
    +++ b/src/rpc/mempool.cpp
    @@ -1301,4 +1301,3 @@ static RPCMethod getorphantxs()
             {
    -            {"verbosity", RPCArg::Type::NUM, RPCArg::Default{0}, "0 for an array of txids (may contain duplicates), 1 for an array of objects with tx details, and 2 for details from (1) and tx hex",
    -             RPCArgOptions{.skip_type_check = true}},
    +            {"verbosity", RPCArg::Type::NUM, RPCArg::Default{0}, "0 for an array of txids (may contain duplicates), 1 for an array of objects with tx details, and 2 for details from (1) and tx hex"},
             },
    @@ -1336,3 +1335,3 @@ static RPCMethod getorphantxs()
     
    -            int verbosity{ParseVerbosity(request.params[0], /*default_verbosity=*/0, /*allow_bool=*/false)};
    +            int verbosity{self.Arg<int>("verbosity")};
     
    diff --git a/test/functional/rpc_orphans.py b/test/functional/rpc_orphans.py
    index 6addb58..2aeed02 100755
    --- a/test/functional/rpc_orphans.py
    +++ b/test/functional/rpc_orphans.py
    @@ -147,4 +147,4 @@ class OrphanRPCsTest(BitcoinTestFramework):
             node = self.nodes[0]
    -        assert_raises_rpc_error(-3, "Verbosity was boolean but only integer allowed", node.getorphantxs, verbosity=True)
    -        assert_raises_rpc_error(-3, "Verbosity was boolean but only integer allowed", node.getorphantxs, verbosity=False)
    +        assert_raises_rpc_error(-3, "type boolean is not of expected type number", node.getorphantxs, verbosity=True)
    +        assert_raises_rpc_error(-3, "type boolean is not of expected type number", node.getorphantxs, verbosity=False)
             help_output = node.help()
    
  6. l0rinc renamed this:
    doc: correct `getorphantxs` rpc verbosity labels
    rpc: fix `getorphantxs` verbosity help and type checking
    on Nov 25, 2026
  7. test: characterize getorphantxs verbosity
    Check that the default verbosity returns the remaining orphan's txid and that verbosity 1 omits its hex.
    The verbosity 1 details check previously inspected the result of a verbosity 2 call.
    2d27b27c68
  8. rpc: use the schema to check getorphantxs verbosity
    The schema already declares `verbosity` as numeric with a default of 0, so use it to check the argument type and supply the default.
    Type errors keep code `-3` and now use the standard message with the argument name and position, which replaces the custom boolean message.
    
    Co-authored-by: maflcko <6399679+maflcko@users.noreply.github.com>
    40061cf39f
  9. refactor: drop allow_bool from ParseVerbosity
    `estimatesmartfee` is the only caller that asks `ParseVerbosity` to reject booleans, and its options type check already rejects them before the call.
    `getblock` and `getrawtransaction` accept booleans for compatibility, so the flag can be removed from all three calls.
    
    Point new RPC methods to `getorphantxs` as an example of integer verbosity checked by the schema.
    e913ca2b16
  10. l0rinc force-pushed on Nov 25, 2026
  11. l0rinc commented at 5:03 PM on November 25, 2026: contributor

    Thanks @maflcko, I’ve applied your suggestion and expanded the PR to test that getorphantxs(verbosity=1) omits tx hex and to remove the redundant allow_bool flag from ParseVerbosity.

  12. DrahtBot added the label CI failed on Nov 25, 2026
  13. maflcko commented at 10:44 AM on November 26, 2026: member

    The ci/cli failure is fixed in https://github.com/bitcoin/bitcoin/pull/36976/commits (ffff10c970346451a04491b5964b0a75b6351f86)

  14. DrahtBot removed the label CI failed on Nov 27, 2026
  15. DrahtBot added the label CI failed on Nov 27, 2026
  16. DrahtBot commented at 5:28 PM on November 27, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task Alpine (musl): https://github.com/bitcoin/bitcoin/actions/runs/45660194112/job/140644356512</sub> <sub>LLM reason (✨ experimental): functional_test_fail: The functional test rpc_orphans.py failed.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • Intermittent network issues can occur; re-run CI for now, and report the issue if they keep happening.

    • A functional or integration test failure may be intermittent or unrelated to this pull request. If no dedicated issue thread exists, create a new one to track it.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-30 03:50 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me