-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: test the reply functionality (via blinded path) using a plugin.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
- Loading branch information
1 parent
587a181
commit edd0230
Showing
2 changed files
with
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
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