core-lightning/tests/plugins/hold_invoice.py
Rusty Russell 380c044668 tests: add plugin for simple invoice delay.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-11 23:19:11 +00:00

19 lines
374 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):
time.sleep(float(plugin.get_option('holdtime')))
return {}
plugin.add_option('holdtime', '10', 'The time to hold invoice for.')
plugin.run()