-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py-client: Add trampoline pay and tests
This commit adds trampoline pay to the python library to allow for testing of the implementation. We also add some basic checks. Signed-off-by: Peter Neuroth <[email protected]>
- Loading branch information
Showing
5 changed files
with
231 additions
and
19 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
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 | ||
|
||
from pyln.client import Plugin | ||
|
||
plugin = Plugin( | ||
dynamic=False, | ||
init_features=1 << 427, | ||
) | ||
|
||
@plugin.hook("htlc_accepted") | ||
def on_htlc_accepted(htlc, onion, plugin, **kwargs): | ||
plugin.log(f"Got onion {onion}") | ||
|
||
# Stip off custom payload as we are the last hop. | ||
new_payload = onion["payload"][6:102] | ||
plugin.log(f"Replace onion payload with {new_payload}") | ||
return {"result": "continue", "payload": new_payload} | ||
|
||
|
||
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