v31.1-roots.1 · Commit 5: [PATCH 05/17] feat(net): preserve Roots peer controls and health view on v31
src/test/denialofservice_tests.cpp
Before: src/test/denialofservice_tests.cpp · After: src/test/denialofservice_tests.cpp
File metadata
index 776a18788e3298954427a06ab07fb54c6d342136..78e0389f553b6626511559707434e8343adab2c8 100644
Download original patch · Release notes
Diff rows 1–13 of 13. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/test/denialofservice_tests.cpp
CHANGED
|
@@ -335,7 +335,13 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
|
|
| 335 |
peerLogic->InitializeNode(*nodes[0], NODE_NETWORK);
|
| 336 |
nodes[0]->fSuccessfullyConnected = true;
|
| 337 |
connman->AddTestNode(*nodes[0]);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
peerLogic->UnitTestMisbehaving(nodes[0]->GetId()); // Should be discouraged
|
|
|
|
|
|
|
| 339 |
BOOST_CHECK(peerLogic->SendMessages(*nodes[0]));
|
| 340 |
|
| 341 |
BOOST_CHECK(banman->IsDiscouraged(addr[0]));
|
|
|
|
| 335 |
peerLogic->InitializeNode(*nodes[0], NODE_NETWORK);
|
| 336 |
nodes[0]->fSuccessfullyConnected = true;
|
| 337 |
connman->AddTestNode(*nodes[0]);
|
| 338 |
+
CNodeStateStats stats;
|
| 339 |
+
BOOST_REQUIRE(peerLogic->GetNodeStateStats(nodes[0]->GetId(), stats));
|
| 340 |
+
BOOST_CHECK_EQUAL(stats.m_misbehavior_score, 0);
|
| 341 |
+
BOOST_CHECK_EQUAL(stats.m_last_block_announcement.count(), 0);
|
| 342 |
peerLogic->UnitTestMisbehaving(nodes[0]->GetId()); // Should be discouraged
|
| 343 |
+
BOOST_REQUIRE(peerLogic->GetNodeStateStats(nodes[0]->GetId(), stats));
|
| 344 |
+
BOOST_CHECK_EQUAL(stats.m_misbehavior_score, 100);
|
| 345 |
BOOST_CHECK(peerLogic->SendMessages(*nodes[0]));
|
| 346 |
|
| 347 |
BOOST_CHECK(banman->IsDiscouraged(addr[0]));
|