Avoids guessing what the timeout should be, use a file trigger. This is more optimal, and should reduce a flake in test_sql under valgrind. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
21 lines
390 B
Python
Executable File
21 lines
390 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Simple plugin to allow testing while closing of HTLC is delayed.
|
|
"""
|
|
|
|
from pyln.client import Plugin
|
|
import os
|
|
import time
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
@plugin.hook('invoice_payment')
|
|
def on_payment(payment, plugin, **kwargs):
|
|
# Block until file appears
|
|
while not os.path.exists("unhold"):
|
|
time.sleep(0.25)
|
|
return {'result': 'continue'}
|
|
|
|
|
|
plugin.run()
|