pytest: Add a zeroreserve test

This commit is contained in:
Christian Decker
2022-06-09 17:07:03 +02:00
parent c3e9cb7a47
commit c5b2aee5c6
2 changed files with 102 additions and 0 deletions

27
tests/plugins/zeroreserve.py Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
"""Use the openchannel hook to selectively opt-into zeroconf
"""
from pyln.client import Plugin
plugin = Plugin()
@plugin.hook('openchannel')
def on_openchannel(openchannel, plugin, **kwargs):
plugin.log(repr(openchannel))
reserve = plugin.options['reserve']['value']
if reserve is None:
return {'result': 'continue'}
else:
return {'result': 'continue', 'reserve': reserve}
plugin.add_option(
'reserve',
None,
'Absolute reserve to require from peers when accepting channels',
)
plugin.run()