From 93a3d7f6320fd50912f481e9e1b417d5d730a732 Mon Sep 17 00:00:00 2001 From: Shahana Farooqui Date: Fri, 14 Jul 2023 22:51:46 -0700 Subject: [PATCH] commando: added check for empty params Changelog-Changed: Protocol: commando commands now allow a missing params field, instead of requiring an empty field. No-schema-diff-check --- plugins/commando.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/commando.c b/plugins/commando.c index 7871da531..6d05e92ed 100644 --- a/plugins/commando.c +++ b/plugins/commando.c @@ -395,7 +395,7 @@ static const char *check_condition(const tal_t *ctx, } /* Rest are params looksup: generate this once! */ - if (strmap_empty(&cinfo->cached_params)) { + if (strmap_empty(&cinfo->cached_params) && cinfo->params) { const jsmntok_t *t; size_t i; @@ -518,7 +518,7 @@ static void try_command(struct node_id *peer, return; } params = json_get_member(buf, toks, "params"); - if (!params || (params->type != JSMN_OBJECT && params->type != JSMN_ARRAY)) { + if (params && (params->type != JSMN_OBJECT && params->type != JSMN_ARRAY)) { commando_error(incoming, COMMANDO_ERROR_REMOTE, "Params must be object or array"); return;