diff --git a/plugins/fundchannel.c b/plugins/fundchannel.c index 00b0d7831..68700ee5a 100644 --- a/plugins/fundchannel.c +++ b/plugins/fundchannel.c @@ -314,7 +314,7 @@ static struct command_result *fundchannel_start(struct command *cmd, json_out_start(ret, NULL, '{'); json_out_addstr(ret, "id", node_id_to_hexstr(tmpctx, fr->id)); - if (cmd->plugin->deprecated_apis) + if (deprecated_apis) json_out_addstr(ret, "satoshi", fr->funding_str); else json_out_addstr(ret, "amount", fr->funding_str); @@ -446,7 +446,7 @@ static struct command_result *json_fundchannel(struct command *cmd, struct funding_req *fr = tal(cmd, struct funding_req); /* For generating help, give new-style. */ - if (!params || !cmd->plugin->deprecated_apis || params->type == JSMN_ARRAY) { + if (!params || !deprecated_apis || params->type == JSMN_ARRAY) { if (!param(cmd, buf, params, p_req("id", param_node_id, &fr->id), p_req("amount", param_string_check_sat, &fr->funding_str), diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 7e986da1c..d6212702b 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -21,6 +21,8 @@ const struct chainparams *chainparams; +bool deprecated_apis; + struct plugin_timer { struct timer timer; struct command_result *(*cb)(struct plugin *p); @@ -666,7 +668,7 @@ static struct command_result *handle_init(struct command *cmd, strerror(errno)); param_obj = json_out_obj(NULL, "config", "allow-deprecated-apis"); - p->deprecated_apis = streq(rpc_delve(tmpctx, p, "listconfigs", + deprecated_apis = streq(rpc_delve(tmpctx, p, "listconfigs", take(param_obj), ".allow-deprecated-apis"), "true"); diff --git a/plugins/libplugin.h b/plugins/libplugin.h index af82017b1..92cb03eb8 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -19,6 +19,8 @@ struct json_out; struct rpc_conn; +extern bool deprecated_apis; + enum plugin_restartability { PLUGIN_STATIC, PLUGIN_RESTARTABLE @@ -72,8 +74,6 @@ struct plugin { /* Timers */ struct timers timers; size_t in_timer; - - bool deprecated_apis; }; struct command {