Browse Source

plugin: Internalize plugin_hook call payload in the request struct

We are about to call multiple plugins, and we'll have to pass the payload into
each call. Sadly the serialized stream gets consumed during the call, so keep
the unserialized payload around.
travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
dc2f9a9088
  1. 2
      lightningd/plugin_hook.c

2
lightningd/plugin_hook.c

@ -13,6 +13,7 @@ struct plugin_hook_request {
int current_plugin; int current_plugin;
const struct plugin_hook *hook; const struct plugin_hook *hook;
void *cb_arg; void *cb_arg;
void *payload;
struct db *db; struct db *db;
}; };
@ -129,6 +130,7 @@ void plugin_hook_call_(struct lightningd *ld, const struct plugin_hook *hook,
ph_req->hook = hook; ph_req->hook = hook;
ph_req->cb_arg = cb_arg; ph_req->cb_arg = cb_arg;
ph_req->db = ld->wallet->db; ph_req->db = ld->wallet->db;
ph_req->payload = payload;
ph_req->current_plugin = 0; ph_req->current_plugin = 0;
ph_req->plugin = hook->plugins[ph_req->current_plugin]; ph_req->plugin = hook->plugins[ph_req->current_plugin];

Loading…
Cancel
Save