mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
commando: require that we have an id field in JSON request.
We don't do this yet, so we add deprecated to those test (until next patch!). Changelog-Deprecated: plugins: `commando` JSON commands without an `id` (see doc/lightningd-rpc.7.md for how to construct a good id field). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -362,7 +362,7 @@ static void try_command(struct node_id *peer,
|
||||
const u8 *msg, size_t msglen)
|
||||
{
|
||||
struct commando *incoming = tal(plugin, struct commando);
|
||||
const jsmntok_t *toks, *method, *params, *rune;
|
||||
const jsmntok_t *toks, *method, *params, *rune, *id;
|
||||
const char *buf = (const char *)msg, *failmsg;
|
||||
struct out_req *req;
|
||||
|
||||
@@ -394,6 +394,12 @@ static void try_command(struct node_id *peer,
|
||||
return;
|
||||
}
|
||||
rune = json_get_member(buf, toks, "rune");
|
||||
id = json_get_member(buf, toks, "id");
|
||||
if (!id && !deprecated_apis) {
|
||||
commando_error(incoming, COMMANDO_ERROR_REMOTE,
|
||||
"missing id field");
|
||||
return;
|
||||
}
|
||||
|
||||
failmsg = check_rune(tmpctx, incoming, peer, buf, method, params, rune);
|
||||
if (failmsg) {
|
||||
|
||||
Reference in New Issue
Block a user