mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-12 08:08:25 +00:00
Use vTxHashes to optimize InitData significantly
This commit is contained in:
parent
811902649d
commit
0d4cb48ef1
@ -99,11 +99,13 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
|
|||||||
|
|
||||||
std::vector<bool> have_txn(txn_available.size());
|
std::vector<bool> have_txn(txn_available.size());
|
||||||
LOCK(pool->cs);
|
LOCK(pool->cs);
|
||||||
for (CTxMemPool::txiter it = pool->mapTx.begin(); it != pool->mapTx.end(); it++) {
|
const std::vector<std::pair<uint256, CTxMemPool::txiter> >& vTxHashes = pool->vTxHashes;
|
||||||
std::unordered_map<uint64_t, uint16_t>::iterator idit = shorttxids.find(cmpctblock.GetShortID(it->GetTx().GetHash()));
|
for (size_t i = 0; i < vTxHashes.size(); i++) {
|
||||||
|
uint64_t shortid = cmpctblock.GetShortID(vTxHashes[i].first);
|
||||||
|
std::unordered_map<uint64_t, uint16_t>::iterator idit = shorttxids.find(shortid);
|
||||||
if (idit != shorttxids.end()) {
|
if (idit != shorttxids.end()) {
|
||||||
if (!have_txn[idit->second]) {
|
if (!have_txn[idit->second]) {
|
||||||
txn_available[idit->second] = it->GetSharedTx();
|
txn_available[idit->second] = vTxHashes[i].second->GetSharedTx();
|
||||||
have_txn[idit->second] = true;
|
have_txn[idit->second] = true;
|
||||||
mempool_count++;
|
mempool_count++;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user