Skip to content

Commit 0c00c0c

Browse files
committed
test: fix off-by-one logic in an eviction protection test
1 parent f7b8094 commit 0c00c0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/net_peer_eviction_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,16 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
289289
BOOST_CHECK(IsProtected(
290290
4, [](NodeEvictionCandidate& c) {
291291
c.m_connected = std::chrono::seconds{c.id};
292-
c.m_is_local = (c.id == 3);
293-
if (c.id == 4) {
292+
c.m_is_local = (c.id == 2);
293+
if (c.id == 3) {
294294
c.m_network = NET_I2P;
295-
} else if (c.id == 2) {
295+
} else if (c.id == 1) {
296296
c.m_network = NET_ONION;
297297
} else {
298298
c.m_network = NET_IPV6;
299299
}
300300
},
301-
/*protected_peer_ids=*/{0, 4},
301+
/*protected_peer_ids=*/{0, 3},
302302
/*unprotected_peer_ids=*/{1, 2},
303303
random_context));
304304

0 commit comments

Comments
 (0)