diff --git a/common/param.c b/common/param.c index 39e5f41d2..4d184eb95 100644 --- a/common/param.c +++ b/common/param.c @@ -53,7 +53,7 @@ static struct command_result *post_check(struct command *cmd, while (first != last && first->required) { if (!first->is_set) { return command_fail(cmd, JSONRPC2_INVALID_PARAMS, - "missing required parameter: '%s'", + "missing required parameter: %s", first->name); } first++; @@ -124,7 +124,7 @@ static struct command_result *parse_by_name(struct command *cmd, if (!p) { if (!allow_extra) { return command_fail(cmd, JSONRPC2_INVALID_PARAMS, - "unknown parameter: '%.*s'", + "unknown parameter: %.*s", t->end - t->start, buffer + t->start); } @@ -133,7 +133,7 @@ static struct command_result *parse_by_name(struct command *cmd, if (p->is_set) { return command_fail(cmd, JSONRPC2_INVALID_PARAMS, - "duplicate json names: '%s'", + "duplicate json names: %s", p->name); } diff --git a/tests/test_plugin.py b/tests/test_plugin.py index dcd3165a1..3e19fcfb4 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -116,3 +116,6 @@ def test_pay_plugin(node_factory): res = l1.rpc.pay(bolt11=inv['bolt11']) assert res['status'] == 'complete' + + with pytest.raises(RpcError, match=r'missing required parameter'): + l1.rpc.call('pay')