-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow hook chaining for the htlc_accepted
hook
#3489
Allow hook chaining for the htlc_accepted
hook
#3489
Commits on Feb 11, 2020
-
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.
Configuration menu - View commit details
-
Copy full SHA for 6b5f510 - Browse repository at this point
Copy the full SHA 6b5f510View commit details -
plugin: Multiple plugins can register a singl hook
Switch from having a single plugin to a list of plugins. If the hook is of type single we will enforce that constraint on the number of registered plugins when attempting to add.
Configuration menu - View commit details
-
Copy full SHA for b4e69c6 - Browse repository at this point
Copy the full SHA b4e69c6View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 532238a - Browse repository at this point
Copy the full SHA 532238aView commit details -
plugin: Split plugin_hook_call_ into initialization and call_next
We will be using `plugin_hook_call_next` as part of the loop to traverse all plugins that registered the hook, so group initialization in the init function and move per-plugin logic into `plugin_hook_call_next`
Configuration menu - View commit details
-
Copy full SHA for b9f6153 - Browse repository at this point
Copy the full SHA b9f6153View commit details -
Configuration menu - View commit details
-
Copy full SHA for ca1d5fc - Browse repository at this point
Copy the full SHA ca1d5fcView commit details -
plugin: Remove special case for plugin stopping while handling hooks
This used to be necessary because we allocated the `plugin_hook_request` off of the plugin instance (only tal allocated object we could grab at that time. Now the plugin was replaced by a list, which itself is tal-allocated, making that workaround pointless, or even wrong once we have multiple plugins registering for that hook.
Configuration menu - View commit details
-
Copy full SHA for 101b5d5 - Browse repository at this point
Copy the full SHA 101b5d5View commit details -
plugin: Allow multiple plugins to register the
htlc_accepted
hookMake the `htlc_accepted` hook the first chained hook in our repertoire. The plugins are called one after the other in order until we have no more plugins or the HTLC was handled by one of the plugins. If no plugins handles the HTLC we continue to handle it internally like always. Handling in this case means the plugin returns either `{"result": "resolve", ...}` or `{"result": "fail", ...}`. Changelog-Changed: plugin: Multiple plugins can now register for the htlc_accepted hook.
Configuration menu - View commit details
-
Copy full SHA for ba9c559 - Browse repository at this point
Copy the full SHA ba9c559View commit details -
doc: Reduce useless nesting in plugins.md
Triple nesting seems a bit excessive, I can't even read the titles in the sidebar of http://lightning.readthedocs.org anymore :-)
Configuration menu - View commit details
-
Copy full SHA for dc5714f - Browse repository at this point
Copy the full SHA dc5714fView commit details -
Configuration menu - View commit details
-
Copy full SHA for d8c2a05 - Browse repository at this point
Copy the full SHA d8c2a05View commit details