Skip to content

Commit 54b45e1

Browse files
committed
RPC/Blockchain: Clarify invalid-action error in scanblocks & scantxoutset
1 parent 5602cc7 commit 54b45e1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/rpc/blockchain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ static RPCHelpMan scantxoutset()
22052205
result.pushKV("unspents", unspents);
22062206
result.pushKV("total_amount", ValueFromAmount(total_in));
22072207
} else {
2208-
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid command");
2208+
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid action '%s'", request.params[0].get_str()));
22092209
}
22102210
return result;
22112211
},
@@ -2402,7 +2402,7 @@ static RPCHelpMan scanblocks()
24022402
ret.pushKV("relevant_blocks", blocks);
24032403
}
24042404
else {
2405-
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid command");
2405+
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid action '%s'", request.params[0].get_str()));
24062406
}
24072407
return ret;
24082408
},

test/functional/rpc_scanblocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def run_test(self):
122122
assert_equal(node.scanblocks("abort"), False)
123123

124124
# test invalid command
125-
assert_raises_rpc_error(-8, "Invalid command", node.scanblocks, "foobar")
125+
assert_raises_rpc_error(-8, "Invalid action 'foobar'", node.scanblocks, "foobar")
126126

127127

128128
if __name__ == '__main__':

0 commit comments

Comments
 (0)