Skip to content

Commit 662394c

Browse files
committed
merge bitcoin#28489: fix incorrect assumption in v2transport_test
1 parent 98782c6 commit 662394c

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
@@ -1364,11 +1364,19 @@ BOOST_AUTO_TEST_CASE(v2transport_test)
13641364
BOOST_CHECK(!(*ret)[1]);
13651365
BOOST_CHECK((*ret)[2] && (*ret)[2]->m_type == "tx" && Span{(*ret)[2]->m_recv} == MakeByteSpan(msg_data_2));
13661366

1367-
// Then send a message with a bit error, expecting failure.
1367+
// Then send a message with a bit error, expecting failure. It's possible this failure does
1368+
// not occur immediately (when the length descriptor was modified), but it should come
1369+
// eventually, and no messages can be delivered anymore.
13681370
tester.SendMessage("bad", msg_data_1);
13691371
tester.Damage();
1370-
ret = tester.Interact();
1371-
BOOST_CHECK(!ret);
1372+
while (true) {
1373+
ret = tester.Interact();
1374+
if (!ret) break; // failure
1375+
BOOST_CHECK(ret->size() == 0); // no message can be delivered
1376+
// Send another message.
1377+
auto msg_data_3 = g_insecure_rand_ctx.randbytes<uint8_t>(InsecureRandRange(10000));
1378+
tester.SendMessage(uint8_t(12), msg_data_3); // getheaders short id
1379+
}
13721380
}
13731381

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

0 commit comments

Comments
 (0)