Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 5: [PATCH 05/17] feat(net): preserve Roots peer controls and health view on v31

src/test/net_peer_eviction_tests.cpp

Before: src/test/net_peer_eviction_tests.cpp · After: src/test/net_peer_eviction_tests.cpp

File metadata
index 5dc2061a18841e82bb38a4558fa8f18c7659b888..8f341d363ad482bdd652c035da76c4b456c0526e 100644

Download original patch · Release notes

Diff rows 1–22 of 22. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/test/net_peer_eviction_tests.cpp CHANGED
@@ -682,4 +682,22 @@ BOOST_AUTO_TEST_CASE(peer_eviction_test)
682
682
  }
683
683
  }
684
684
 
685
+ BOOST_AUTO_TEST_CASE(force_eviction_preserves_unconditional_protection)
686
+ {
687
+ NodeEvictionCandidate candidate{};
688
+ candidate.id = 17;
689
+ candidate.m_conn_type = ConnectionType::INBOUND;
690
+ BOOST_CHECK(!SelectNodeToEvict({candidate}));
691
+ BOOST_CHECK_EQUAL(*SelectNodeToEvict({candidate}, true), 17);
692
+ candidate.m_noban = true;
693
+ BOOST_CHECK(!SelectNodeToEvict({candidate}, true));
694
+ candidate.m_noban = false;
695
+ for (const auto type : {ConnectionType::MANUAL, ConnectionType::OUTBOUND_FULL_RELAY,
696
+ ConnectionType::BLOCK_RELAY, ConnectionType::FEELER}) {
697
+ candidate.m_conn_type = type;
698
+ BOOST_CHECK(!SelectNodeToEvict({candidate}, true));
699
+ }
700
+ BOOST_CHECK(!SelectNodeToEvict({}, true));
701
+ }
702
+
685
703
  BOOST_AUTO_TEST_SUITE_END()