From 73df875771e4e8697f0e36031815eb75362113b6 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Tue, 9 Dec 2025 12:58:47 -0600 Subject: [PATCH] RPC/Blockchain: Clarify invalid-action error in scantxoutset Partial backport of bitcoin/bitcoin#26508 Only the scantxoutset changes are applicable as Dash does not have the scanblocks RPC function. Co-authored-by: Luke Dashjr --- src/rpc/blockchain.cpp | 2 +- test/functional/rpc_scantxoutset.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index a2c4aa399072..ab2f6fffc635 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2584,7 +2584,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; }, diff --git a/test/functional/rpc_scantxoutset.py b/test/functional/rpc_scantxoutset.py index 52acebb58f07..b5940c31e340 100755 --- a/test/functional/rpc_scantxoutset.py +++ b/test/functional/rpc_scantxoutset.py @@ -128,8 +128,8 @@ def run_test(self): # Check that second arg is needed for start assert_raises_rpc_error(-1, "scanobjects argument is required for the start action", self.nodes[0].scantxoutset, "start") - # Check that invalid command give error - assert_raises_rpc_error(-8, "Invalid command", self.nodes[0].scantxoutset, "invalid_command") + # Check that invalid action gives error + assert_raises_rpc_error(-8, "Invalid action 'invalid_command'", self.nodes[0].scantxoutset, "invalid_command") if __name__ == "__main__":