mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pytest: test the reply functionality (via blinded path) using a plugin.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
21
tests/plugins/onionmessage-reply.py
Executable file
21
tests/plugins/onionmessage-reply.py
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
This plugin is used to test the `onion_message` hook.
|
||||
"""
|
||||
from lightning import Plugin
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.hook("onion_message")
|
||||
def on_onion_message(plugin, onion_message, **kwargs):
|
||||
if 'reply_path' not in onion_message:
|
||||
plugin.log("no reply path")
|
||||
return
|
||||
|
||||
plugin.rpc.call('sendonionmessage', [onion_message['reply_path']])
|
||||
plugin.log("Sent reply via {}".format(onion_message['reply_path']))
|
||||
return {"result": "continue"}
|
||||
|
||||
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user