plugin: Introduce plugin type to allow singleton and chaining

The newly introduced type is used to determine what the call semantics of the
hook are. We have `single` corresponding to the old behavior, as well as
`chain` which allows multiple plugins to register for the hook, and they are
then called sequentially (if all plugins return `{"result": "continue"}`) or
exit the chain if the hook event was handled.
This commit is contained in:
Christian Decker
2020-02-04 12:52:54 +01:00
committed by Rusty Russell
parent 30580731a6
commit 9a2a09efd6
7 changed files with 30 additions and 11 deletions

View File

@@ -753,7 +753,8 @@ rpc_command_hook_callback(struct rpc_command_hook_payload *p,
"Bad response to 'rpc_command' hook."));
}
REGISTER_PLUGIN_HOOK(rpc_command, rpc_command_hook_callback,
REGISTER_PLUGIN_HOOK(rpc_command, PLUGIN_HOOK_SINGLE,
rpc_command_hook_callback,
struct rpc_command_hook_payload *,
rpc_command_hook_serialize,
struct rpc_command_hook_payload *);