Skip to content

Commit 544d6e7

Browse files
tests: include the test for the tests
Some implementations send an error message and at the same time will close the connection. Locally this will cause a reading from a closed socket. However, ldk now has a different life cycle for the connection, and we should receive the error message before. ``` lnprototest.errors.EventError: `Peer did not disconnect` on event [{"event": "ExpectDisconnect", "file": "test_bolt2-01-open_channel.py", "pos": "345"},] =========================== short test summary info ============================ FAILED ../lnprototest/tests/test_bolt2-01-open_channel.py::test_open_channel_opener_side_wrong_announcement_signatures ============= 1 failed, 29 passed, 17 skipped in 96.15s (0:01:36) ============== ``` Link: #134 Reported-by: @Psycho-Pirate Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 19981c3 commit 544d6e7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/test_bolt1-02-unknown-messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from typing import Any
77

8-
from lnprototest import TryAll, Connect, ExpectMsg, Msg, RawMsg, Runner
8+
from lnprototest import Connect, ExpectMsg, Msg, RawMsg, Runner
99
from lnprototest.event import ExpectDisconnect
1010
from lnprototest.utils import run_runner
1111

tests/test_bolt2-01-open_channel.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Variations on open_channel, accepter + opener perspectives
22
from lnprototest import (
33
TryAll,
4-
OneOf,
4+
Sequence,
55
ExpectDisconnect,
66
Block,
77
FundChannel,
88
ExpectMsg,
99
ExpectTx,
10-
ExpectError,
1110
Msg,
1211
RawMsg,
1312
AcceptFunding,
@@ -26,8 +25,6 @@
2625
remote_funding_privkey,
2726
bitfield,
2827
Block,
29-
ExpectError,
30-
Disconnect,
3128
)
3229
from lnprototest.stash import (
3330
sent,
@@ -291,6 +288,8 @@ def test_open_channel_opener_side(runner: Runner) -> None:
291288
def test_open_channel_opener_side_wrong_announcement_signatures(runner: Runner) -> None:
292289
"""Testing the case where the channel is announces in the correct way but one node
293290
send the wrong signature inside the `announcement_signatures` message."""
291+
from lnprototest.clightning import Runner as CLightningRunner
292+
294293
connections_events = connect_to_node_helper(
295294
runner=runner,
296295
tx_spendable=tx_spendable,
@@ -302,6 +301,8 @@ def test_open_channel_opener_side_wrong_announcement_signatures(runner: Runner)
302301

303302
dummy_sign = "138c93afb2013c39f959e70a163c3d6d8128cf72f8ae143f87b9d1fd6bb0ad30321116b9c58d69fca9fb33c214f681b664e53d5640abc2fdb972dc62a5571053"
304303
short_channel_id = opts["short_channel_id"]
304+
305+
is_cln = isinstance(runner, CLightningRunner)
305306
test_events = [
306307
# BOLT 2:
307308
#
@@ -342,6 +343,7 @@ def test_open_channel_opener_side_wrong_announcement_signatures(runner: Runner)
342343
#
343344
# So we should change the OneOf to all exception and stop when
344345
# the first one succided
345-
ExpectDisconnect(),
346+
Sequence(ExpectDisconnect(), enable=is_cln),
347+
Sequence(ExpectMsg("error"), enable=(not is_cln)),
346348
]
347349
run_runner(runner, merge_events_sequences(pre_events, test_events))

0 commit comments

Comments
 (0)