diff --git a/common/json_command.c b/common/json_command.c index 613b02e1d646..0e081cb6b11e 100644 --- a/common/json_command.c +++ b/common/json_command.c @@ -8,7 +8,7 @@ command_fail_badparam(struct command *cmd, const jsmntok_t *tok, const char *msg) { - if (command_dev_apis(cmd)) { + if (command_dev_apis(cmd) || command_check_only(cmd)) { return command_fail(cmd, JSONRPC2_INVALID_PARAMS, "%s: %s: invalid token '%.*s'", paramname, msg, diff --git a/tests/test_misc.py b/tests/test_misc.py index 5a35ab150d32..6cd2a9ed905c 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -4244,3 +4244,9 @@ def test_badparam_discretion(node_factory): l1.rpc.checkrune(rune='THIS IS NOT ACTUALLY A RUNE') l1.daemon.wait_for_log(r"checkrune: Invalid parameter rune \(should be base64 string\): token '\"THIS IS NOT ACTUALLY A RUNE\"'") + + # But: check command *SHOULD* give as much info as we can. + with pytest.raises(RpcError, match='rune: should be base64 string: invalid token') as err: + l1.rpc.check('checkrune', rune='THIS IS NOT ACTUALLY A RUNE') + + assert err.value.error['message'] == "rune: should be base64 string: invalid token '\"THIS IS NOT ACTUALLY A RUNE\"'"