Changeset View
Changeset View
Standalone View
Standalone View
src/bench/mempool_eviction.cpp
Show All 11 Lines | |||||
static void AddTx(const CTransaction &tx, const CAmount &nFee, | static void AddTx(const CTransaction &tx, const CAmount &nFee, | ||||
CTxMemPool &pool) { | CTxMemPool &pool) { | ||||
int64_t nTime = 0; | int64_t nTime = 0; | ||||
double dPriority = 10.0; | double dPriority = 10.0; | ||||
unsigned int nHeight = 1; | unsigned int nHeight = 1; | ||||
bool spendsCoinbase = false; | bool spendsCoinbase = false; | ||||
unsigned int sigOpCost = 4; | unsigned int sigOpCost = 4; | ||||
LockPoints lp; | LockPoints lp; | ||||
pool.addUnchecked(tx.GetId(), | pool.addUnchecked(tx.GetHash(), | ||||
CTxMemPoolEntry(MakeTransactionRef(tx), nFee, nTime, | CTxMemPoolEntry(MakeTransactionRef(tx), nFee, nTime, | ||||
dPriority, nHeight, | dPriority, nHeight, | ||||
tx.GetValueOut().GetSatoshis(), | tx.GetValueOut().GetSatoshis(), | ||||
spendsCoinbase, sigOpCost, lp)); | spendsCoinbase, sigOpCost, lp)); | ||||
} | } | ||||
// Right now this is only testing eviction performance in an extremely small | // Right now this is only testing eviction performance in an extremely small | ||||
// mempool. Code needs to be written to generate a much wider variety of | // mempool. Code needs to be written to generate a much wider variety of | ||||
Show All 10 Lines | static void MempoolEviction(benchmark::State &state) { | ||||
tx2.vin.resize(1); | tx2.vin.resize(1); | ||||
tx2.vin[0].scriptSig = CScript() << OP_2; | tx2.vin[0].scriptSig = CScript() << OP_2; | ||||
tx2.vout.resize(1); | tx2.vout.resize(1); | ||||
tx2.vout[0].scriptPubKey = CScript() << OP_2 << OP_EQUAL; | tx2.vout[0].scriptPubKey = CScript() << OP_2 << OP_EQUAL; | ||||
tx2.vout[0].nValue = 10 * COIN.GetSatoshis(); | tx2.vout[0].nValue = 10 * COIN.GetSatoshis(); | ||||
CMutableTransaction tx3 = CMutableTransaction(); | CMutableTransaction tx3 = CMutableTransaction(); | ||||
tx3.vin.resize(1); | tx3.vin.resize(1); | ||||
tx3.vin[0].prevout = COutPoint(tx2.GetId(), 0); | tx3.vin[0].prevout = COutPoint(tx2.GetHash(), 0); | ||||
tx3.vin[0].scriptSig = CScript() << OP_2; | tx3.vin[0].scriptSig = CScript() << OP_2; | ||||
tx3.vout.resize(1); | tx3.vout.resize(1); | ||||
tx3.vout[0].scriptPubKey = CScript() << OP_3 << OP_EQUAL; | tx3.vout[0].scriptPubKey = CScript() << OP_3 << OP_EQUAL; | ||||
tx3.vout[0].nValue = 10 * COIN.GetSatoshis(); | tx3.vout[0].nValue = 10 * COIN.GetSatoshis(); | ||||
CMutableTransaction tx4 = CMutableTransaction(); | CMutableTransaction tx4 = CMutableTransaction(); | ||||
tx4.vin.resize(2); | tx4.vin.resize(2); | ||||
tx4.vin[0].prevout.SetNull(); | tx4.vin[0].prevout.SetNull(); | ||||
tx4.vin[0].scriptSig = CScript() << OP_4; | tx4.vin[0].scriptSig = CScript() << OP_4; | ||||
tx4.vin[1].prevout.SetNull(); | tx4.vin[1].prevout.SetNull(); | ||||
tx4.vin[1].scriptSig = CScript() << OP_4; | tx4.vin[1].scriptSig = CScript() << OP_4; | ||||
tx4.vout.resize(2); | tx4.vout.resize(2); | ||||
tx4.vout[0].scriptPubKey = CScript() << OP_4 << OP_EQUAL; | tx4.vout[0].scriptPubKey = CScript() << OP_4 << OP_EQUAL; | ||||
tx4.vout[0].nValue = 10 * COIN.GetSatoshis(); | tx4.vout[0].nValue = 10 * COIN.GetSatoshis(); | ||||
tx4.vout[1].scriptPubKey = CScript() << OP_4 << OP_EQUAL; | tx4.vout[1].scriptPubKey = CScript() << OP_4 << OP_EQUAL; | ||||
tx4.vout[1].nValue = 10 * COIN.GetSatoshis(); | tx4.vout[1].nValue = 10 * COIN.GetSatoshis(); | ||||
CMutableTransaction tx5 = CMutableTransaction(); | CMutableTransaction tx5 = CMutableTransaction(); | ||||
tx5.vin.resize(2); | tx5.vin.resize(2); | ||||
tx5.vin[0].prevout = COutPoint(tx4.GetId(), 0); | tx5.vin[0].prevout = COutPoint(tx4.GetHash(), 0); | ||||
tx5.vin[0].scriptSig = CScript() << OP_4; | tx5.vin[0].scriptSig = CScript() << OP_4; | ||||
tx5.vin[1].prevout.SetNull(); | tx5.vin[1].prevout.SetNull(); | ||||
tx5.vin[1].scriptSig = CScript() << OP_5; | tx5.vin[1].scriptSig = CScript() << OP_5; | ||||
tx5.vout.resize(2); | tx5.vout.resize(2); | ||||
tx5.vout[0].scriptPubKey = CScript() << OP_5 << OP_EQUAL; | tx5.vout[0].scriptPubKey = CScript() << OP_5 << OP_EQUAL; | ||||
tx5.vout[0].nValue = 10 * COIN.GetSatoshis(); | tx5.vout[0].nValue = 10 * COIN.GetSatoshis(); | ||||
tx5.vout[1].scriptPubKey = CScript() << OP_5 << OP_EQUAL; | tx5.vout[1].scriptPubKey = CScript() << OP_5 << OP_EQUAL; | ||||
tx5.vout[1].nValue = 10 * COIN.GetSatoshis(); | tx5.vout[1].nValue = 10 * COIN.GetSatoshis(); | ||||
CMutableTransaction tx6 = CMutableTransaction(); | CMutableTransaction tx6 = CMutableTransaction(); | ||||
tx6.vin.resize(2); | tx6.vin.resize(2); | ||||
tx6.vin[0].prevout = COutPoint(tx4.GetId(), 1); | tx6.vin[0].prevout = COutPoint(tx4.GetHash(), 1); | ||||
tx6.vin[0].scriptSig = CScript() << OP_4; | tx6.vin[0].scriptSig = CScript() << OP_4; | ||||
tx6.vin[1].prevout.SetNull(); | tx6.vin[1].prevout.SetNull(); | ||||
tx6.vin[1].scriptSig = CScript() << OP_6; | tx6.vin[1].scriptSig = CScript() << OP_6; | ||||
tx6.vout.resize(2); | tx6.vout.resize(2); | ||||
tx6.vout[0].scriptPubKey = CScript() << OP_6 << OP_EQUAL; | tx6.vout[0].scriptPubKey = CScript() << OP_6 << OP_EQUAL; | ||||
tx6.vout[0].nValue = 10 * COIN.GetSatoshis(); | tx6.vout[0].nValue = 10 * COIN.GetSatoshis(); | ||||
tx6.vout[1].scriptPubKey = CScript() << OP_6 << OP_EQUAL; | tx6.vout[1].scriptPubKey = CScript() << OP_6 << OP_EQUAL; | ||||
tx6.vout[1].nValue = 10 * COIN.GetSatoshis(); | tx6.vout[1].nValue = 10 * COIN.GetSatoshis(); | ||||
CMutableTransaction tx7 = CMutableTransaction(); | CMutableTransaction tx7 = CMutableTransaction(); | ||||
tx7.vin.resize(2); | tx7.vin.resize(2); | ||||
tx7.vin[0].prevout = COutPoint(tx5.GetId(), 0); | tx7.vin[0].prevout = COutPoint(tx5.GetHash(), 0); | ||||
tx7.vin[0].scriptSig = CScript() << OP_5; | tx7.vin[0].scriptSig = CScript() << OP_5; | ||||
tx7.vin[1].prevout = COutPoint(tx6.GetId(), 0); | tx7.vin[1].prevout = COutPoint(tx6.GetHash(), 0); | ||||
tx7.vin[1].scriptSig = CScript() << OP_6; | tx7.vin[1].scriptSig = CScript() << OP_6; | ||||
tx7.vout.resize(2); | tx7.vout.resize(2); | ||||
tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | ||||
tx7.vout[0].nValue = 10 * COIN.GetSatoshis(); | tx7.vout[0].nValue = 10 * COIN.GetSatoshis(); | ||||
tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | ||||
tx7.vout[1].nValue = 10 * COIN.GetSatoshis(); | tx7.vout[1].nValue = 10 * COIN.GetSatoshis(); | ||||
CTxMemPool pool(CFeeRate(1000)); | CTxMemPool pool(CFeeRate(1000)); | ||||
Show All 15 Lines |