Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/peermanager_tests.cpp
Show First 20 Lines • Show All 571 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(proof_conflict) { | ||||
// Empty proof, no peer. | // Empty proof, no peer. | ||||
BOOST_CHECK_EQUAL(getPeerId({}), NO_PEER); | BOOST_CHECK_EQUAL(getPeerId({}), NO_PEER); | ||||
// Multiple inputs. | // Multiple inputs. | ||||
const PeerId peer4 = getPeerId({COutPoint(txid1, 2), COutPoint(txid2, 2)}); | const PeerId peer4 = getPeerId({COutPoint(txid1, 2), COutPoint(txid2, 2)}); | ||||
BOOST_CHECK(peer4 != NO_PEER && peer4 != peer1); | BOOST_CHECK(peer4 != NO_PEER && peer4 != peer1); | ||||
// Duplicated input. | // Duplicated input. | ||||
BOOST_CHECK_EQUAL(getPeerId({COutPoint(txid1, 3), COutPoint(txid1, 3)}), | { | ||||
NO_PEER); | ProofBuilder pb(0, 0, CPubKey()); | ||||
COutPoint o(txid1, 3); | |||||
pb.addUTXO(o, v, height, false, key); | |||||
PeerId peerid = pm.getPeerId(std::make_shared<Proof>( | |||||
TestProofBuilder::buildDuplicatedStakes(pb))); | |||||
BOOST_CHECK_EQUAL(peerid, NO_PEER); | |||||
} | |||||
// Multiple inputs, collision on first input. | // Multiple inputs, collision on first input. | ||||
BOOST_CHECK_EQUAL(getPeerId({COutPoint(txid1, 0), COutPoint(txid2, 4)}), | BOOST_CHECK_EQUAL(getPeerId({COutPoint(txid1, 0), COutPoint(txid2, 4)}), | ||||
NO_PEER); | NO_PEER); | ||||
// Mutliple inputs, collision on second input. | // Mutliple inputs, collision on second input. | ||||
BOOST_CHECK_EQUAL(getPeerId({COutPoint(txid1, 4), COutPoint(txid2, 0)}), | BOOST_CHECK_EQUAL(getPeerId({COutPoint(txid1, 4), COutPoint(txid2, 0)}), | ||||
NO_PEER); | NO_PEER); | ||||
▲ Show 20 Lines • Show All 202 Lines • Show Last 20 Lines |