Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
| @@ -1303,17 +1303,17 @@ static RPCMethod getorphantxs() | |||
| RPCArgOptions{.skip_type_check = true}}, | |||
There was a problem hiding this comment.
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()getorphantxs rpc verbosity labelsgetorphantxs verbosity help and type checking
48beca0 to
e913ca2
Compare
|
Thanks @maflcko, I’ve applied your suggestion and expanded the PR to test that |
|
The ci/cli failure is fixed in https://github.com/bitcoin/bitcoin/pull/36976/commits (ffff10c) |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
This is needed to get the full error message. Otherwise running the test with --usecli fails with: AssertionError: Expected substring not found in error message: substring: 'JSON value of type bool is not of expected type number' error message: 'Wrong type passed:'. (cherry picked from commit fae4370)
e913ca2 to
5a9061c
Compare
The headings still refer to the removed `verbose` alias, so following the help and passing `verbose=1` returns `Unknown named parameter verbose`. Check all three result headings in the existing RPC help test.
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.
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 <[email protected]>
`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.
5a9061c to
8944504
Compare

Problem: #31043 removed the
verbosealias fromgetorphantxs, but all three result headings in its help still use that name. Passingverbose=1as the help suggests returnsUnknown named parameter verbose. The RPC also bypasses the schema’s numeric type check and reports a custom error for boolean inputs.Fix: Use
verbosityin all three result headings. Let the RPC schema check the argument type and supply its declared default of0. For boolean inputs, the RPC still returns error-3, now with the standard message identifying the argument by name and position.