libplugin: include the rpc conn into the global state

And rename the struct name, as it's now only used for RPC.
This commit is contained in:
darosior
2020-01-27 00:42:00 +01:00
committed by Rusty Russell
parent 98e8aac75f
commit 499dce1c38
5 changed files with 116 additions and 117 deletions

View File

@@ -1666,20 +1666,20 @@ static struct command_result *json_listpays(struct command *cmd,
take(json_out_obj(NULL, "bolt11", b11str)));
}
static void init(struct plugin_conn *rpc,
static void init(struct plugin *p,
const char *buf UNUSED, const jsmntok_t *config UNUSED)
{
const char *field;
field = rpc_delve(tmpctx, "getinfo",
take(json_out_obj(NULL, NULL, NULL)), rpc, ".id");
field = rpc_delve(tmpctx, p, "getinfo",
take(json_out_obj(NULL, NULL, NULL)), ".id");
if (!node_id_from_hexstr(field, strlen(field), &my_id))
plugin_err("getinfo didn't contain valid id: '%s'", field);
field = rpc_delve(tmpctx, "listconfigs",
field = rpc_delve(tmpctx, p, "listconfigs",
take(json_out_obj(NULL,
"config", "max-locktime-blocks")),
rpc, ".max-locktime-blocks");
".max-locktime-blocks");
maxdelay_default = atoi(field);
}