lightningd/plugin_hook.c: Make db_write a chained hook.

Fixes: #4219

Changelog-Changed: Plugins: Multiple plugins can now register `db_write` hooks.
This commit is contained in:
ZmnSCPxj jxPCSnmZ
2020-11-23 13:05:56 +08:00
committed by Rusty Russell
parent 904e110554
commit 32de621886
4 changed files with 105 additions and 24 deletions

View File

@@ -897,6 +897,14 @@ to error without
committing to the database!
This is the expected way to halt and catch fire.
`db_write` is a parallel-chained hook, i.e., multiple plugins can
register it, and all of them will be invoked simultaneously without
regard for order of registration.
The hook is considered handled if all registered plugins return
`{"result": "continue"}`.
If any plugin returns anything else, `lightningd` will error without
committing to the database.
### `invoice_payment`
This hook is called whenever a valid payment for an unpaid invoice has arrived.