Browse Source
plugin: Add pointer to jsonrpc so we can add new methods
Signed-off-by: Christian Decker <@cdecker>
plugin-3
Christian Decker
6 years ago
No known key found for this signature in database
GPG Key ID: 1416D83DC4F0E86D
4 changed files with
13 additions and
4 deletions
-
lightningd/lightningd.c
-
lightningd/plugin.c
-
lightningd/plugin.h
-
lightningd/test/run-find_my_abspath.c
|
|
@ -214,7 +214,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->plugins = plugins_new(ld, ld->log_book, ld->jsonrpc); |
|
|
|
|
|
|
|
return ld; |
|
|
|
} |
|
|
@ -788,6 +788,7 @@ int main(int argc, char *argv[]) |
|
|
|
tal_free(ld->jsonrpc); |
|
|
|
db_commit_transaction(ld->wallet->db); |
|
|
|
|
|
|
|
tal_free(ld->plugins); |
|
|
|
remove(ld->pidfile); |
|
|
|
|
|
|
|
/* FIXME: pay can have children off tmpctx which unlink from
|
|
|
|
|
|
@ -59,6 +59,9 @@ struct plugins { |
|
|
|
UINTMAP(struct plugin_request *) pending_requests; |
|
|
|
struct log *log; |
|
|
|
struct log_book *log_book; |
|
|
|
|
|
|
|
/* RPC interface to bind JSON-RPC methods to */ |
|
|
|
struct jsonrpc *rpc; |
|
|
|
}; |
|
|
|
|
|
|
|
struct json_output { |
|
|
@ -75,12 +78,15 @@ struct plugin_opt { |
|
|
|
char *value; |
|
|
|
}; |
|
|
|
|
|
|
|
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 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; |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -16,7 +16,8 @@ struct plugins; |
|
|
|
/**
|
|
|
|
* 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); |
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the registered plugins. |
|
|
|
|
|
@ -135,7 +135,8 @@ void plugins_config(struct plugins *plugins UNNEEDED) |
|
|
|
void plugins_init(struct plugins *plugins UNNEEDED) |
|
|
|
{ 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 plugins *plugins_new(const tal_t *ctx UNNEEDED, struct log_book *log_book UNNEEDED, |
|
|
|
struct jsonrpc *rpc UNNEEDED) |
|
|
|
{ fprintf(stderr, "plugins_new called!\n"); abort(); } |
|
|
|
/* Generated stub for register_opts */ |
|
|
|
void register_opts(struct lightningd *ld UNNEEDED) |
|
|
|