mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
tests: add plugin for simple invoice delay.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
18
tests/plugins/hold_invoice.py
Executable file
18
tests/plugins/hold_invoice.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/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):
|
||||
time.sleep(float(plugin.get_option('holdtime')))
|
||||
return {}
|
||||
|
||||
|
||||
plugin.add_option('holdtime', '10', 'The time to hold invoice for.')
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user