From 26f60f83d56bab0ce617c24e8e3fd2c034e0f529 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 23 Feb 2019 13:41:14 +1030 Subject: [PATCH] libplugin: add deprecated_apis flag for plugins to access. Signed-off-by: Rusty Russell --- plugins/libplugin.c | 8 ++++++++ plugins/libplugin.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 363b1ae94..d47f18ef7 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -25,6 +25,8 @@ static u64 next_outreq_id; * struct json_command as it's good practice to have those const. */ static STRMAP(const char *) usagemap; +bool deprecated_apis; + struct plugin_conn { int fd; MEMBUF(char) mb; @@ -472,6 +474,12 @@ static struct command_result *handle_init(struct command *init_cmd, rpctok->end - rpctok->start, buf + rpctok->start, strerror(errno)); + deprecated_apis = streq(rpc_delve(tmpctx, "listconfigs", + "'config': 'allow-deprecated-apis'", + init_cmd->rpc, + ".allow-deprecated-apis"), + "true"); + if (init) init(init_cmd->rpc); diff --git a/plugins/libplugin.h b/plugins/libplugin.h index b38c7aa1f..036e18ca7 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -12,6 +12,8 @@ struct command; struct plugin_conn; +extern bool deprecated_apis; + /* Create an array of these, one for each command you support. */ struct plugin_command { const char *name;