Changeset View
Changeset View
Standalone View
Standalone View
src/test/mempool_tests.cpp
Show First 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(MempoolIndexingTest) { | ||||
std::vector<std::string> sortedOrder; | std::vector<std::string> sortedOrder; | ||||
sortedOrder.resize(5); | sortedOrder.resize(5); | ||||
sortedOrder[0] = tx3.GetId().ToString(); // 0 | sortedOrder[0] = tx3.GetId().ToString(); // 0 | ||||
sortedOrder[1] = tx5.GetId().ToString(); // 10000 | sortedOrder[1] = tx5.GetId().ToString(); // 10000 | ||||
sortedOrder[2] = tx1.GetId().ToString(); // 10000 | sortedOrder[2] = tx1.GetId().ToString(); // 10000 | ||||
sortedOrder[3] = tx4.GetId().ToString(); // 15000 | sortedOrder[3] = tx4.GetId().ToString(); // 15000 | ||||
sortedOrder[4] = tx2.GetId().ToString(); // 20000 | sortedOrder[4] = tx2.GetId().ToString(); // 20000 | ||||
LOCK(pool.cs); | |||||
CheckSort<descendant_score>(pool, sortedOrder, "MempoolIndexingTest1"); | CheckSort<descendant_score>(pool, sortedOrder, "MempoolIndexingTest1"); | ||||
/* low fee but with high fee child */ | /* low fee but with high fee child */ | ||||
/* tx6 -> tx7 -> tx8, tx9 -> tx10 */ | /* tx6 -> tx7 -> tx8, tx9 -> tx10 */ | ||||
CMutableTransaction tx6 = CMutableTransaction(); | CMutableTransaction tx6 = CMutableTransaction(); | ||||
tx6.vout.resize(1); | tx6.vout.resize(1); | ||||
tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; | tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; | ||||
tx6.vout[0].nValue = 20 * COIN; | tx6.vout[0].nValue = 20 * COIN; | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | if (tx1.GetId() < tx5.GetId()) { | ||||
sortedOrder[2] = tx1.GetId().ToString(); | sortedOrder[2] = tx1.GetId().ToString(); | ||||
sortedOrder[3] = tx5.GetId().ToString(); | sortedOrder[3] = tx5.GetId().ToString(); | ||||
} else { | } else { | ||||
sortedOrder[2] = tx5.GetId().ToString(); | sortedOrder[2] = tx5.GetId().ToString(); | ||||
sortedOrder[3] = tx1.GetId().ToString(); | sortedOrder[3] = tx1.GetId().ToString(); | ||||
} | } | ||||
sortedOrder[4] = tx3.GetId().ToString(); // 0 | sortedOrder[4] = tx3.GetId().ToString(); // 0 | ||||
LOCK(pool.cs); | |||||
CheckSort<ancestor_score>(pool, sortedOrder, | CheckSort<ancestor_score>(pool, sortedOrder, | ||||
"MempoolAncestorIndexingTest1"); | "MempoolAncestorIndexingTest1"); | ||||
/* low fee parent with high fee child */ | /* low fee parent with high fee child */ | ||||
/* tx6 (0) -> tx7 (high) */ | /* tx6 (0) -> tx7 (high) */ | ||||
CMutableTransaction tx6 = CMutableTransaction(); | CMutableTransaction tx6 = CMutableTransaction(); | ||||
tx6.vout.resize(1); | tx6.vout.resize(1); | ||||
tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; | tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; | ||||
▲ Show 20 Lines • Show All 317 Lines • Show Last 20 Lines |