Removed implicit CTransaction conversion from benchmaks

This commit is contained in:
lucash-dev 2018-12-08 16:30:55 -08:00
parent ed61abedb2
commit 8db0c3d42b
2 changed files with 6 additions and 5 deletions

View file

@ -35,14 +35,14 @@ SetupDummyInputs(CBasicKeyStore& keystoreRet, CCoinsViewCache& coinsRet)
dummyTransactions[0].vout[0].scriptPubKey << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG; dummyTransactions[0].vout[0].scriptPubKey << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG;
dummyTransactions[0].vout[1].nValue = 50 * COIN; dummyTransactions[0].vout[1].nValue = 50 * COIN;
dummyTransactions[0].vout[1].scriptPubKey << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG; dummyTransactions[0].vout[1].scriptPubKey << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG;
AddCoins(coinsRet, dummyTransactions[0], 0); AddCoins(coinsRet, CTransaction(dummyTransactions[0]), 0);
dummyTransactions[1].vout.resize(2); dummyTransactions[1].vout.resize(2);
dummyTransactions[1].vout[0].nValue = 21 * COIN; dummyTransactions[1].vout[0].nValue = 21 * COIN;
dummyTransactions[1].vout[0].scriptPubKey = GetScriptForDestination(key[2].GetPubKey().GetID()); dummyTransactions[1].vout[0].scriptPubKey = GetScriptForDestination(key[2].GetPubKey().GetID());
dummyTransactions[1].vout[1].nValue = 22 * COIN; dummyTransactions[1].vout[1].nValue = 22 * COIN;
dummyTransactions[1].vout[1].scriptPubKey = GetScriptForDestination(key[3].GetPubKey().GetID()); dummyTransactions[1].vout[1].scriptPubKey = GetScriptForDestination(key[3].GetPubKey().GetID());
AddCoins(coinsRet, dummyTransactions[1], 0); AddCoins(coinsRet, CTransaction(dummyTransactions[1]), 0);
return dummyTransactions; return dummyTransactions;
} }
@ -76,10 +76,11 @@ static void CCoinsCaching(benchmark::State& state)
t1.vout[0].scriptPubKey << OP_1; t1.vout[0].scriptPubKey << OP_1;
// Benchmark. // Benchmark.
const CTransaction tx_1(t1);
while (state.KeepRunning()) { while (state.KeepRunning()) {
bool success = AreInputsStandard(t1, coins); bool success = AreInputsStandard(tx_1, coins);
assert(success); assert(success);
CAmount value = coins.GetValueIn(t1); CAmount value = coins.GetValueIn(tx_1);
assert(value == (50 + 21 + 22) * COIN); assert(value == (50 + 21 + 22) * COIN);
} }
} }

View file

@ -127,7 +127,7 @@ static void MempoolEviction(benchmark::State& state)
AddTx(tx6_r, 1100LL, pool); AddTx(tx6_r, 1100LL, pool);
AddTx(tx7_r, 9000LL, pool); AddTx(tx7_r, 9000LL, pool);
pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4); pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4);
pool.TrimToSize(GetVirtualTransactionSize(tx1)); pool.TrimToSize(GetVirtualTransactionSize(*tx1_r));
} }
} }