Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/peermanager_tests.cpp
Show First 20 Lines • Show All 1,007 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(preferred_conflicting_proof) { | ||||
// proofSeq10 is a worst candidate than proofSeq30, so it goes to the | // proofSeq10 is a worst candidate than proofSeq30, so it goes to the | ||||
// conflicting pool. | // conflicting pool. | ||||
BOOST_CHECK(!pm.registerProof(proofSeq10)); | BOOST_CHECK(!pm.registerProof(proofSeq10)); | ||||
BOOST_CHECK(pm.isBoundToPeer(proofSeq30->getId())); | BOOST_CHECK(pm.isBoundToPeer(proofSeq30->getId())); | ||||
BOOST_CHECK(!pm.isBoundToPeer(proofSeq10->getId())); | BOOST_CHECK(!pm.isBoundToPeer(proofSeq10->getId())); | ||||
BOOST_CHECK(pm.isInConflictingPool(proofSeq10->getId())); | BOOST_CHECK(pm.isInConflictingPool(proofSeq10->getId())); | ||||
// proofSeq20 is a worst candidate than proofSeq30 but a better one than | // proofSeq20 is a worst candidate than proofSeq30 but a better one than | ||||
// proogSeq10. However it is not permitted to override a proof in the | // proogSeq10, so it replaces it in the conflicting pool and proofSeq10 is | ||||
// conflicting pool so proofSeq20 is rejectd | // evicted. | ||||
BOOST_CHECK(!pm.registerProof(proofSeq20)); | BOOST_CHECK(!pm.registerProof(proofSeq20)); | ||||
BOOST_CHECK(pm.isBoundToPeer(proofSeq30->getId())); | BOOST_CHECK(pm.isBoundToPeer(proofSeq30->getId())); | ||||
BOOST_CHECK(pm.isInConflictingPool(proofSeq10->getId())); | BOOST_CHECK(!pm.isBoundToPeer(proofSeq20->getId())); | ||||
BOOST_CHECK(!pm.exists(proofSeq20->getId())); | BOOST_CHECK(pm.isInConflictingPool(proofSeq20->getId())); | ||||
BOOST_CHECK(!pm.exists(proofSeq10->getId())); | |||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |