Browse Source

libplugin: make deprecated_apis a global

travis-debug
darosior 5 years ago
committed by Rusty Russell
parent
commit
b6b2e6727e
  1. 4
      plugins/fundchannel.c
  2. 4
      plugins/libplugin.c
  3. 4
      plugins/libplugin.h

4
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),

4
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");

4
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 {

Loading…
Cancel
Save