mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +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:
@@ -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
|
*code. Here we initialize the context that will keep track and control
|
||||||
*the plugins.
|
*the plugins.
|
||||||
*/
|
*/
|
||||||
ld->plugins = plugins_new(ld, ld->log_book, ld->jsonrpc, ld);
|
ld->plugins = plugins_new(ld, ld->log_book, ld);
|
||||||
|
|
||||||
return ld;
|
return ld;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ struct plugins {
|
|||||||
struct log *log;
|
struct log *log;
|
||||||
struct log_book *log_book;
|
struct log_book *log_book;
|
||||||
|
|
||||||
/* RPC interface to bind JSON-RPC methods to */
|
|
||||||
struct jsonrpc *rpc;
|
|
||||||
|
|
||||||
struct timers timers;
|
struct timers timers;
|
||||||
struct lightningd *ld;
|
struct lightningd *ld;
|
||||||
};
|
};
|
||||||
@@ -93,14 +90,13 @@ struct plugin_opt {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
|
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;
|
struct plugins *p;
|
||||||
p = tal(ctx, struct plugins);
|
p = tal(ctx, struct plugins);
|
||||||
list_head_init(&p->plugins);
|
list_head_init(&p->plugins);
|
||||||
p->log_book = log_book;
|
p->log_book = log_book;
|
||||||
p->log = new_log(p, log_book, "plugin-manager");
|
p->log = new_log(p, log_book, "plugin-manager");
|
||||||
p->rpc = rpc;
|
|
||||||
timers_init(&p->timers, time_mono());
|
timers_init(&p->timers, time_mono());
|
||||||
p->ld = ld;
|
p->ld = ld;
|
||||||
return p;
|
return p;
|
||||||
@@ -679,7 +675,7 @@ static bool plugin_rpcmethod_add(struct plugin *plugin,
|
|||||||
|
|
||||||
cmd->deprecated = false;
|
cmd->deprecated = false;
|
||||||
cmd->dispatch = plugin_rpcmethod_dispatch;
|
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,
|
log_broken(plugin->log,
|
||||||
"Could not register method \"%s\", a method with "
|
"Could not register method \"%s\", a method with "
|
||||||
"that name is already registered",
|
"that name is already registered",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ struct plugin;
|
|||||||
* Create a new plugins context.
|
* Create a new plugins context.
|
||||||
*/
|
*/
|
||||||
struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
|
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.
|
* 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(); }
|
{ fprintf(stderr, "plugins_init called!\n"); abort(); }
|
||||||
/* Generated stub for plugins_new */
|
/* Generated stub for plugins_new */
|
||||||
struct plugins *plugins_new(const tal_t *ctx UNNEEDED, struct log_book *log_book UNNEEDED,
|
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(); }
|
{ fprintf(stderr, "plugins_new called!\n"); abort(); }
|
||||||
/* Generated stub for register_opts */
|
/* Generated stub for register_opts */
|
||||||
void register_opts(struct lightningd *ld UNNEEDED)
|
void register_opts(struct lightningd *ld UNNEEDED)
|
||||||
|
|||||||
Reference in New Issue
Block a user