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.
This commit is contained in:
Christian Decker 2020-02-05 13:30:07 +01:00 committed by Rusty Russell
parent b25e195c2c
commit dc2f9a9088

View File

@ -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];