mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-01 03:24:41 +01:00
9d4148ce68
We recently noticed that the way we unpack the call arguments for hooks and notifications in pylightning breaks pretty quickly once you start changing the hook and notification params. If you add params they will not get mapped correctly causing the plugin to error out. This can be fixed by adding a `VAR_KEYWORD` argument to the calbacks, i.e., by adding a single `**kwargs` argument at the end of the signature. This commit adds a check that such a catch-all argument exists, and emits a warning if it doesn't. It also fixes up the plugins that we ship ourselves. Signed-off-by: Christian Decker <decker.christian@gmail.com>
19 lines
384 B
Python
Executable File
19 lines
384 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Simple plugin to allow testing while closing of HTLC is delayed.
|
|
"""
|
|
|
|
from lightning import Plugin
|
|
import time
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
@plugin.hook('invoice_payment')
|
|
def on_payment(payment, plugin, **kwargs):
|
|
time.sleep(float(plugin.get_option('holdtime')))
|
|
return {}
|
|
|
|
|
|
plugin.add_option('holdtime', '10', 'The time to hold invoice for.')
|
|
plugin.run()
|