mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
libplugin: make deprecated_apis a global
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user