mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
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:
@@ -110,6 +110,7 @@ const struct feature_set *plugin_feature_set(const struct plugin *p);
|
||||
struct out_req *jsonrpc_request_start_(struct plugin *plugin,
|
||||
struct command *cmd,
|
||||
const char *method,
|
||||
const char *id_prefix,
|
||||
struct command_result *(*cb)(struct command *command,
|
||||
const char *buf,
|
||||
const jsmntok_t *result,
|
||||
@@ -124,6 +125,7 @@ struct out_req *jsonrpc_request_start_(struct plugin *plugin,
|
||||
* "error" members. */
|
||||
#define jsonrpc_request_start(plugin, cmd, method, cb, errcb, arg) \
|
||||
jsonrpc_request_start_((plugin), (cmd), (method), \
|
||||
json_id_prefix(tmpctx, (cmd)), \
|
||||
typesafe_cb_preargs(struct command_result *, void *, \
|
||||
(cb), (arg), \
|
||||
struct command *command, \
|
||||
@@ -139,8 +141,8 @@ struct out_req *jsonrpc_request_start_(struct plugin *plugin,
|
||||
|
||||
/* This variant has callbacks received whole obj, not "result" or
|
||||
* "error" members. It also doesn't start params{}. */
|
||||
#define jsonrpc_request_whole_object_start(plugin, cmd, method, cb, arg) \
|
||||
jsonrpc_request_start_((plugin), (cmd), (method), \
|
||||
#define jsonrpc_request_whole_object_start(plugin, cmd, method, id_prefix, cb, arg) \
|
||||
jsonrpc_request_start_((plugin), (cmd), (method), (id_prefix), \
|
||||
typesafe_cb_preargs(struct command_result *, void *, \
|
||||
(cb), (arg), \
|
||||
struct command *command, \
|
||||
@@ -470,6 +472,9 @@ struct createonion_response *json_to_createonion_response(const tal_t *ctx,
|
||||
struct route_hop *json_to_route(const tal_t *ctx, const char *buffer,
|
||||
const jsmntok_t *toks);
|
||||
|
||||
/* Create a prefix (ending in /) for this cmd_id, if any. */
|
||||
const char *json_id_prefix(const tal_t *ctx, const struct command *cmd);
|
||||
|
||||
#if DEVELOPER
|
||||
struct htable;
|
||||
void plugin_set_memleak_handler(struct plugin *plugin,
|
||||
|
||||
Reference in New Issue
Block a user