Files
palladum-lightning/tests/plugins/onionmessage_forward_fail_notification.py
Rusty Russell f0c5ea2e1e doc: document and test the onionmessage_forward_fail notification.
Doing exactly what we expect to do: initiate a connection and then
forward the message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-12-05 17:38:16 +10:30

21 lines
650 B
Python
Executable File

#!/usr/bin/env python3
""" We get an onionmessage_forward_fail notification, and open a connection
"""
from pyln.client import Plugin
plugin = Plugin()
@plugin.subscribe("onionmessage_forward_fail")
def on_onionmessage_forward_fail(onionmessage_forward_fail, **kwargs):
plugin.log(f"Received onionmessage_forward_fail {onionmessage_forward_fail}")
plugin.rpc.connect(onionmessage_forward_fail['next_node_id'])
# injectonionmessage expects to unwrap, so hand it *incoming*
plugin.rpc.injectonionmessage(onionmessage_forward_fail['path_key'],
onionmessage_forward_fail['incoming'])
plugin.run()