commando: send id inside JSON request.

All JSON-RPC calls should have one!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-01-03 14:53:28 +10:30
parent 19db6a25e4
commit b3fa4b932e
2 changed files with 7 additions and 6 deletions

View File

@@ -679,9 +679,10 @@ static struct command_result *json_commando(struct command *cmd,
tal_arr_expand(&outgoing_commands, ocmd);
tal_add_destructor2(ocmd, destroy_commando, &outgoing_commands);
/* We pass through their JSON id untouched. */
json = tal_fmt(tmpctx,
"{\"method\":\"%s\",\"params\":%s", method,
cparams ? cparams : "{}");
"{\"method\":\"%s\",\"id\":%s,\"params\":%s", method,
cmd->id, cparams ? cparams : "{}");
if (rune)
tal_append_fmt(&json, ",\"rune\":\"%s\"", rune);
tal_append_fmt(&json, "}");