mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
plugins: don't keep redundant jsonrpc pointer.
We have ld already, just use that in the one place we need. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
dabdefefae
commit
c506d42679
4 changed files with 5 additions and 9 deletions
|
@ -215,7 +215,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
|
|||
*code. Here we initialize the context that will keep track and control
|
||||
*the plugins.
|
||||
*/
|
||||
ld->plugins = plugins_new(ld, ld->log_book, ld->jsonrpc, ld);
|
||||
ld->plugins = plugins_new(ld, ld->log_book, ld);
|
||||
|
||||
return ld;
|
||||
}
|
||||
|
|
|
@ -76,9 +76,6 @@ struct plugins {
|
|||
struct log *log;
|
||||
struct log_book *log_book;
|
||||
|
||||
/* RPC interface to bind JSON-RPC methods to */
|
||||
struct jsonrpc *rpc;
|
||||
|
||||
struct timers timers;
|
||||
struct lightningd *ld;
|
||||
};
|
||||
|
@ -93,14 +90,13 @@ struct plugin_opt {
|
|||
};
|
||||
|
||||
struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
|
||||
struct jsonrpc *rpc, struct lightningd *ld)
|
||||
struct lightningd *ld)
|
||||
{
|
||||
struct plugins *p;
|
||||
p = tal(ctx, struct plugins);
|
||||
list_head_init(&p->plugins);
|
||||
p->log_book = log_book;
|
||||
p->log = new_log(p, log_book, "plugin-manager");
|
||||
p->rpc = rpc;
|
||||
timers_init(&p->timers, time_mono());
|
||||
p->ld = ld;
|
||||
return p;
|
||||
|
@ -679,7 +675,7 @@ static bool plugin_rpcmethod_add(struct plugin *plugin,
|
|||
|
||||
cmd->deprecated = false;
|
||||
cmd->dispatch = plugin_rpcmethod_dispatch;
|
||||
if (!jsonrpc_command_add(plugin->plugins->rpc, cmd)) {
|
||||
if (!jsonrpc_command_add(plugin->plugins->ld->jsonrpc, cmd)) {
|
||||
log_broken(plugin->log,
|
||||
"Could not register method \"%s\", a method with "
|
||||
"that name is already registered",
|
||||
|
|
|
@ -22,7 +22,7 @@ struct plugin;
|
|||
* Create a new plugins context.
|
||||
*/
|
||||
struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
|
||||
struct jsonrpc *rpc, struct lightningd *ld);
|
||||
struct lightningd *ld);
|
||||
|
||||
/**
|
||||
* Initialize the registered plugins.
|
||||
|
|
|
@ -137,7 +137,7 @@ void plugins_init(struct plugins *plugins UNNEEDED, const char *dev_plugin_debug
|
|||
{ fprintf(stderr, "plugins_init called!\n"); abort(); }
|
||||
/* Generated stub for plugins_new */
|
||||
struct plugins *plugins_new(const tal_t *ctx UNNEEDED, struct log_book *log_book UNNEEDED,
|
||||
struct jsonrpc *rpc UNNEEDED, struct lightningd *ld UNNEEDED)
|
||||
struct lightningd *ld UNNEEDED)
|
||||
{ fprintf(stderr, "plugins_new called!\n"); abort(); }
|
||||
/* Generated stub for register_opts */
|
||||
void register_opts(struct lightningd *ld UNNEEDED)
|
||||
|
|
Loading…
Add table
Reference in a new issue