-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: test pay during channel open
Notably this parses the listpeerchannels output while the state is still uncommitted, i.e., state = OPENINGD.
- Loading branch information
1 parent
c4edec8
commit 688408c
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
"""Plugin to test openchannel_hook | ||
Will simply accept any channel. Useful fot testing chained hook. | ||
""" | ||
|
||
from pyln.client import Plugin | ||
import time | ||
|
||
plugin = Plugin() | ||
|
||
|
||
@plugin.hook('openchannel') | ||
def on_openchannel(openchannel, plugin, **kwargs): | ||
delaytime = float(plugin.get_option('delaytime')) | ||
msg = f'delaying WIRE_ACCEPT_CHANNEL for {delaytime}s' | ||
plugin.log(msg) | ||
time.sleep(delaytime) | ||
return {'result': 'continue'} | ||
|
||
|
||
@plugin.hook('openchannel2') | ||
def on_openchannel2(openchannel2, plugin, **kwargs): | ||
delaytime = float(plugin.get_option('delaytime')) | ||
msg = f'delaying WIRE_ACCEPT_CHANNEL for {delaytime}s' | ||
plugin.log(msg) | ||
time.sleep(delaytime) | ||
return {'result': 'continue'} | ||
|
||
|
||
plugin.add_option('delaytime', '10', 'How long to hold the WIRE_OPEN_CHANNEL.') | ||
plugin.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters