commando: build ID of command based on the id they give us.

We change the libplugin API so commando can provide its own ID base.

This id chaining enables much nicer diagnostics!

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 b3fa4b932e
commit 0201e6977f
5 changed files with 55 additions and 25 deletions

View File

@@ -107,6 +107,9 @@ void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNN
const jsmntok_t *json_get_member(const char *buffer UNNEEDED, const jsmntok_t tok[] UNNEEDED,
const char *label UNNEEDED)
{ fprintf(stderr, "json_get_member called!\n"); abort(); }
/* Generated stub for json_id_prefix */
const char *json_id_prefix(const tal_t *ctx UNNEEDED, const struct command *cmd UNNEEDED)
{ fprintf(stderr, "json_id_prefix called!\n"); abort(); }
/* Generated stub for json_next */
const jsmntok_t *json_next(const jsmntok_t *tok UNNEEDED)
{ fprintf(stderr, "json_next called!\n"); abort(); }
@@ -184,6 +187,7 @@ bool json_tok_streq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct out_req *jsonrpc_request_start_(struct plugin *plugin UNNEEDED,
struct command *cmd UNNEEDED,
const char *method UNNEEDED,
const char *id_prefix UNNEEDED,
struct command_result *(*cb)(struct command *command UNNEEDED,
const char *buf UNNEEDED,
const jsmntok_t *result UNNEEDED,