tests: add plugin for simple invoice delay.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-05-31 17:00:19 +09:30
parent b48c644e7a
commit 380c044668
2 changed files with 29 additions and 1 deletions

18
tests/plugins/hold_invoice.py Executable file
View 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()