Files
palladum-lightning/tests/plugins/hold_invoice.py
Rusty Russell 939aec3b61 pytest: make hold_timeout.py test plugin release on a prompt, not timeout.
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>
2026-02-09 14:48:15 +10:30

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()