libplugin: add method string to jsonrpc callbacks, implement generic helpers.

Without knowing what method was called, we can't have useful general logging
methods, so go through the pain of adding "const char *method" everywhere,
and add:

1. ignore_and_complete - we're done when jsonrpc returned
2. log_broken_and_complete - we're done, but emit BROKEN log.
3. plugin_broken_cb - if this happens, fail the plugin.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-11-07 11:57:37 +10:30
parent 9f92af9fab
commit c797b6fb20
33 changed files with 367 additions and 102 deletions

View File

@@ -706,6 +706,7 @@ static struct command_result *process_json_result(struct command *cmd,
}
static struct command_result *default_list_done(struct command *cmd,
const char *method,
const char *buf,
const jsmntok_t *result,
struct db_query *dbq)
@@ -797,6 +798,7 @@ static struct command_result *channels_refresh(struct command *cmd,
struct db_query *dbq);
static struct command_result *listchannels_one_done(struct command *cmd,
const char *method,
const char *buf,
const jsmntok_t *result,
struct db_query *dbq)
@@ -896,6 +898,7 @@ static struct command_result *nodes_refresh(struct command *cmd,
struct db_query *dbq);
static struct command_result *listnodes_one_done(struct command *cmd,
const char *method,
const char *buf,
const jsmntok_t *result,
struct db_query *dbq)