aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2022-01-26 10:34:30 +0100
committerJon Atack <jon@atack.com>2022-01-26 10:35:11 +0100
commit0c00c0c981fc0b6cec101e68e8c1aeda1ccf33bb (patch)
tree70c337277b511ffe5b2b45ee56658a48c0dff0ca
parentf7b8094d611531c6b41a94715dbc01f56257ccd2 (diff)
downloadbitcoin-0c00c0c981fc0b6cec101e68e8c1aeda1ccf33bb.tar.xz
test: fix off-by-one logic in an eviction protection test
-rw-r--r--src/test/net_peer_eviction_tests.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/net_peer_eviction_tests.cpp b/src/test/net_peer_eviction_tests.cpp
index 7abea0506d..14a53f3e70 100644
--- a/src/test/net_peer_eviction_tests.cpp
+++ b/src/test/net_peer_eviction_tests.cpp
@@ -289,16 +289,16 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
BOOST_CHECK(IsProtected(
4, [](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
- c.m_is_local = (c.id == 3);
- if (c.id == 4) {
+ c.m_is_local = (c.id == 2);
+ if (c.id == 3) {
c.m_network = NET_I2P;
- } else if (c.id == 2) {
+ } else if (c.id == 1) {
c.m_network = NET_ONION;
} else {
c.m_network = NET_IPV6;
}
},
- /*protected_peer_ids=*/{0, 4},
+ /*protected_peer_ids=*/{0, 3},
/*unprotected_peer_ids=*/{1, 2},
random_context));