Skip to content

Commit 3f4e1bb

Browse files
committed
tests: fix incorrect assumption in v2transport_test
1 parent 717a4d8 commit 3f4e1bb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/test/net_tests.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,11 +1357,19 @@ BOOST_AUTO_TEST_CASE(v2transport_test)
13571357
BOOST_CHECK(!(*ret)[1]);
13581358
BOOST_CHECK((*ret)[2] && (*ret)[2]->m_type == "tx" && Span{(*ret)[2]->m_recv} == MakeByteSpan(msg_data_2));
13591359

1360-
// Then send a message with a bit error, expecting failure.
1360+
// Then send a message with a bit error, expecting failure. It's possible this failure does
1361+
// not occur immediately (when the length descriptor was modified), but it should come
1362+
// eventually, and no messages can be delivered anymore.
13611363
tester.SendMessage("bad", msg_data_1);
13621364
tester.Damage();
1363-
ret = tester.Interact();
1364-
BOOST_CHECK(!ret);
1365+
while (true) {
1366+
ret = tester.Interact();
1367+
if (!ret) break; // failure
1368+
BOOST_CHECK(ret->size() == 0); // no message can be delivered
1369+
// Send another message.
1370+
auto msg_data_3 = g_insecure_rand_ctx.randbytes<uint8_t>(InsecureRandRange(10000));
1371+
tester.SendMessage(uint8_t(12), msg_data_3); // getheaders short id
1372+
}
13651373
}
13661374

13671375
// Normal scenario, with a transport in responder node.

0 commit comments

Comments
 (0)