From 54b45e155e02cba19975be0bb826ff748d7e895e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 15 Nov 2022 21:07:11 +0000 Subject: [PATCH] RPC/Blockchain: Clarify invalid-action error in scanblocks & scantxoutset --- src/rpc/blockchain.cpp | 4 ++-- test/functional/rpc_scanblocks.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index bc1028aec39..98257e8b998 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2205,7 +2205,7 @@ static RPCHelpMan scantxoutset() result.pushKV("unspents", unspents); result.pushKV("total_amount", ValueFromAmount(total_in)); } else { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid command"); + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid action '%s'", request.params[0].get_str())); } return result; }, @@ -2402,7 +2402,7 @@ static RPCHelpMan scanblocks() ret.pushKV("relevant_blocks", blocks); } else { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid command"); + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid action '%s'", request.params[0].get_str())); } return ret; }, diff --git a/test/functional/rpc_scanblocks.py b/test/functional/rpc_scanblocks.py index 68c84b17a22..743cdf89ed6 100755 --- a/test/functional/rpc_scanblocks.py +++ b/test/functional/rpc_scanblocks.py @@ -122,7 +122,7 @@ class ScanblocksTest(BitcoinTestFramework): assert_equal(node.scanblocks("abort"), False) # test invalid command - assert_raises_rpc_error(-8, "Invalid command", node.scanblocks, "foobar") + assert_raises_rpc_error(-8, "Invalid action 'foobar'", node.scanblocks, "foobar") if __name__ == '__main__':