mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +01:00
openchannel: test new hook chainable mechanics
This commit is contained in:
committed by
Rusty Russell
parent
a3e18a6aba
commit
2816c08036
20
tests/plugins/openchannel_hook_reject.py
Executable file
20
tests/plugins/openchannel_hook_reject.py
Executable 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()
|
||||
Reference in New Issue
Block a user