mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
23af9d4972
Updated to the BOLT, and a few tweaks, and we can send giant onion_messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
23 lines
590 B
Python
Executable File
23 lines
590 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
This plugin is used to test the `onion_message` hook.
|
|
"""
|
|
from pyln.client 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("Got onion_message invoice '{}'".format(onion_message['invoice']))
|
|
plugin.log("Sent reply via {}".format(onion_message['reply_path']))
|
|
return {"result": "continue"}
|
|
|
|
|
|
plugin.run()
|