Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 623 Lines • ▼ Show 20 Lines | while (!vecPriority.empty() && !blockFinished) { | ||||
// If tx is dependent on other mempool txs which haven't yet been | // If tx is dependent on other mempool txs which haven't yet been | ||||
// included then put it in the waitSet. | // included then put it in the waitSet. | ||||
if (isStillDependent(iter)) { | if (isStillDependent(iter)) { | ||||
waitPriMap.insert(std::make_pair(iter, actualPriority)); | waitPriMap.insert(std::make_pair(iter, actualPriority)); | ||||
continue; | continue; | ||||
} | } | ||||
// If this tx fits in the block add it, otherwise keep looping. | // If this tx fits in the block add it, otherwise keep looping. | ||||
if (TestForBlock(iter)) { | if (!TestForBlock(iter)) { | ||||
continue; | |||||
} | |||||
AddToBlock(iter); | AddToBlock(iter); | ||||
// If now that this txs is added we've surpassed our desired | // If now that this txs is added we've surpassed our desired priority | ||||
// priority size or have dropped below the AllowFreeThreshold, then | // size, then we're done adding priority transactions. | ||||
// we're done adding priority txs. | if (nBlockSize >= nBlockPrioritySize) { | ||||
if (nBlockSize >= nBlockPrioritySize || | break; | ||||
!AllowFree(actualPriority)) { | } | ||||
// if we have dropped below the AllowFreeThreshold, then we're done | |||||
// adding priority transactions. | |||||
if (!AllowFree(actualPriority)) { | |||||
break; | break; | ||||
} | } | ||||
// This tx was successfully added, so add transactions that depend | // This tx was successfully added, so add transactions that depend | ||||
// on this one to the priority queue to try again. | // on this one to the priority queue to try again. | ||||
for (CTxMemPool::txiter child : mempool.GetMemPoolChildren(iter)) { | for (CTxMemPool::txiter child : mempool.GetMemPoolChildren(iter)) { | ||||
waitPriIter wpiter = waitPriMap.find(child); | waitPriIter wpiter = waitPriMap.find(child); | ||||
if (wpiter != waitPriMap.end()) { | if (wpiter == waitPriMap.end()) { | ||||
vecPriority.push_back( | continue; | ||||
TxCoinAgePriority(wpiter->second, child)); | |||||
std::push_heap(vecPriority.begin(), vecPriority.end(), | |||||
pricomparer); | |||||
waitPriMap.erase(wpiter); | |||||
} | |||||
} | } | ||||
vecPriority.push_back(TxCoinAgePriority(wpiter->second, child)); | |||||
std::push_heap(vecPriority.begin(), vecPriority.end(), pricomparer); | |||||
waitPriMap.erase(wpiter); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
void IncrementExtraNonce(const Config &config, CBlock *pblock, | void IncrementExtraNonce(const Config &config, CBlock *pblock, | ||||
const CBlockIndex *pindexPrev, | const CBlockIndex *pindexPrev, | ||||
unsigned int &nExtraNonce) { | unsigned int &nExtraNonce) { | ||||
// Update nExtraNonce | // Update nExtraNonce | ||||
Show All 19 Lines |