openchannel: test new hook chainable mechanics

This commit is contained in:
Michael Schmoock
2020-08-21 12:38:51 +02:00
committed by Rusty Russell
parent a3e18a6aba
commit 2816c08036
6 changed files with 158 additions and 45 deletions

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Plugin to test openchannel_hook
Will simply reject any channel with message "reject on principle".
Useful fot testing chained hook.
"""
from pyln.client import Plugin
plugin = Plugin()
@plugin.hook('openchannel')
def on_openchannel(openchannel, plugin, **kwargs):
msg = "reject on principle"
plugin.log(msg)
return {'result': 'reject', 'error_message': msg}
plugin.run()