mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
lightningd: check command should return as much detail as possible.
If they're explicitly calling "check", don't obfuscate the result! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
9fd29d35dd
commit
cb4dd7489c
2 changed files with 7 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -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\"'"
|
||||
|
|
Loading…
Add table
Reference in a new issue