mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pytest: Add a simple test for the hooks
This uses the `htlc_accepted` hook to delay payment acceptance. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
7499f7ddd4
commit
b54577041a
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
from lightning import Plugin
|
||||
|
||||
import time
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
@@ -34,5 +34,12 @@ def on_disconnect(plugin, id):
|
||||
plugin.log("Received disconnect event for peer {}".format(id))
|
||||
|
||||
|
||||
@plugin.hook("htlc_accepted")
|
||||
def on_htlc_accepted(plugin):
|
||||
plugin.log('on_htlc_accepted called')
|
||||
time.sleep(20)
|
||||
return None
|
||||
|
||||
|
||||
plugin.add_option('greeting', 'Hello', 'The greeting I should use.')
|
||||
plugin.run()
|
||||
|
||||
Reference in New Issue
Block a user