Skip to content

Commit 73df875

Browse files
Claude Codeluke-jr
andcommitted
RPC/Blockchain: Clarify invalid-action error in scantxoutset
Partial backport of bitcoin#26508 Only the scantxoutset changes are applicable as Dash does not have the scanblocks RPC function. Co-authored-by: Luke Dashjr <[email protected]>
1 parent e3d61f2 commit 73df875

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2584,7 +2584,7 @@ static RPCHelpMan scantxoutset()
25842584
result.pushKV("unspents", unspents);
25852585
result.pushKV("total_amount", ValueFromAmount(total_in));
25862586
} else {
2587-
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid command");
2587+
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid action '%s'", request.params[0].get_str()));
25882588
}
25892589
return result;
25902590
},

test/functional/rpc_scantxoutset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def run_test(self):
128128
# Check that second arg is needed for start
129129
assert_raises_rpc_error(-1, "scanobjects argument is required for the start action", self.nodes[0].scantxoutset, "start")
130130

131-
# Check that invalid command give error
132-
assert_raises_rpc_error(-8, "Invalid command", self.nodes[0].scantxoutset, "invalid_command")
131+
# Check that invalid action gives error
132+
assert_raises_rpc_error(-8, "Invalid action 'invalid_command'", self.nodes[0].scantxoutset, "invalid_command")
133133

134134

135135
if __name__ == "__main__":

0 commit comments

Comments
 (0)