-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lnprototest: refactoring the way to write a test
Changelog-Fixed: pytest consider a exception an event that don't need to happens, and this keep alive all the subdeamon that lnprotetotest ran.We fixed with a try-catch- Signed-off-by: Vincenzo Palazzo <[email protected]>
- Loading branch information
1 parent
f34aac0
commit 442f33e
Showing
4 changed files
with
89 additions
and
276 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Spec helper is a collection of functions to help to speed up the | ||
operation of interoperability testing. | ||
It contains a method to generate the correct sequence of channel opening | ||
and, and it feels a dictionary with all the propriety that needs to | ||
be used after this sequence of steps. | ||
author: https://github.com/vincenzopalazzo | ||
""" | ||
from typing import List, Union | ||
|
||
from lnprototest import ( | ||
TryAll, | ||
Connect, | ||
Block, | ||
ExpectMsg, | ||
RawMsg, | ||
Msg, | ||
Runner, | ||
Funding, | ||
) | ||
from helpers import ( | ||
utxo, | ||
) | ||
|
||
|
||
def open_and_announce_channel_helper( | ||
runner: Runner, tx_spendable: str, opts: dict | ||
) -> List[Union[Block, Connect, ExpectMsg, TryAll]]: | ||
funding, funding_tx = Funding.from_utxo( | ||
*utxo(0), | ||
local_node_privkey="02", | ||
local_funding_privkey="10", | ||
remote_node_privkey="03", | ||
remote_funding_privkey="20" | ||
) | ||
opts["funding"] = funding | ||
opts["funding_tx"] = funding_tx | ||
return [ | ||
Block(blockheight=102, txs=[tx_spendable]), | ||
Connect(connprivkey="03"), | ||
ExpectMsg("init"), | ||
Msg("init", globalfeatures="", features=""), | ||
Block(blockheight=103, number=6, txs=[funding_tx]), | ||
RawMsg(funding.channel_announcement("103x1x0", "")), | ||
] |
Oops, something went wrong.