-
Notifications
You must be signed in to change notification settings - Fork 913
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
1 parent
f1ad98e
commit 84f15fd
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters