diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 5e25535c8..3f607e89e 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -583,6 +583,14 @@ static const jsmntok_t *sync_req(const tal_t *ctx, return contents; } +const jsmntok_t *jsonrpc_request_sync(const tal_t *ctx, struct plugin *plugin, + const char *method, + const struct json_out *params TAKES, + const char **resp) +{ + return sync_req(ctx, plugin, method, params, resp); +} + /* Returns contents of scanning guide on 'result' */ static const char *rpc_scan_core(const tal_t *ctx, struct plugin *plugin, diff --git a/plugins/libplugin.h b/plugins/libplugin.h index ac3313d3e..1c09a7800 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -478,4 +478,11 @@ void plugin_set_memleak_handler(struct plugin *plugin, struct htable *memtable)); #endif /* DEVELOPER */ +/* Synchronously call a JSON-RPC method and return its contents and + * the parser token. */ +const jsmntok_t *jsonrpc_request_sync(const tal_t *ctx, struct plugin *plugin, + const char *method, + const struct json_out *params TAKES, + const char **resp); + #endif /* LIGHTNING_PLUGINS_LIBPLUGIN_H */