forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: Add tests for htlc_accepted_hook
Two tests: one for failures and one for in-path resolution. Signed-off-by: Christian Decker <[email protected]>
- Loading branch information
1 parent
2b81e02
commit 9fd8be6
Showing
3 changed files
with
81 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,15 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from lightning import Plugin | ||
|
||
plugin = Plugin() | ||
|
||
|
||
@plugin.hook("htlc_accepted") | ||
def on_htlc_accepted(htlc, onion, plugin): | ||
plugin.log("Failing htlc on purpose") | ||
plugin.log("onion: %r" % (onion)) | ||
return {"result": "fail", "failure_code": 16399} | ||
|
||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from lightning import Plugin | ||
|
||
plugin = Plugin() | ||
|
||
|
||
@plugin.hook("htlc_accepted") | ||
def on_htlc_accepted(onion, htlc, plugin): | ||
return {"result": "resolve", "payment_key": "00" * 32} | ||
|
||
|
||
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