More iterator cleanups.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
b4ec903ac4
commit
3383c4855f
22
src/main.cpp
22
src/main.cpp
|
@ -3870,10 +3870,8 @@ bool ReceivedBlockTransactions(
|
|||
}
|
||||
std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex);
|
||||
while (range.first != range.second) {
|
||||
std::multimap<CBlockIndex*, CBlockIndex*>::iterator it = range.first;
|
||||
queue.push_back(it->second);
|
||||
range.first++;
|
||||
mapBlocksUnlinked.erase(it);
|
||||
queue.push_back(range.first->second);
|
||||
range.first = mapBlocksUnlinked.erase(range.first);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -4411,10 +4409,10 @@ void PruneOneBlockFile(const int fileNumber)
|
|||
// mapBlocksUnlinked or setBlockIndexCandidates.
|
||||
std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex->pprev);
|
||||
while (range.first != range.second) {
|
||||
std::multimap<CBlockIndex *, CBlockIndex *>::iterator it = range.first;
|
||||
range.first++;
|
||||
if (it->second == pindex) {
|
||||
mapBlocksUnlinked.erase(it);
|
||||
if (range.first->second == pindex) {
|
||||
range.first = mapBlocksUnlinked.erase(range.first);
|
||||
} else {
|
||||
++range.first;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5160,20 +5158,18 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB
|
|||
queue.pop_front();
|
||||
std::pair<std::multimap<uint256, CDiskBlockPos>::iterator, std::multimap<uint256, CDiskBlockPos>::iterator> range = mapBlocksUnknownParent.equal_range(head);
|
||||
while (range.first != range.second) {
|
||||
std::multimap<uint256, CDiskBlockPos>::iterator it = range.first;
|
||||
if (ReadBlockFromDisk(block, it->second, chainparams.GetConsensus()))
|
||||
if (ReadBlockFromDisk(block, range.first->second, chainparams.GetConsensus()))
|
||||
{
|
||||
LogPrintf("%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(),
|
||||
head.ToString());
|
||||
CValidationState dummy;
|
||||
if (ProcessNewBlock(dummy, chainparams, NULL, &block, true, &it->second))
|
||||
if (ProcessNewBlock(dummy, chainparams, NULL, &block, true, &(range.first->second)))
|
||||
{
|
||||
nLoaded++;
|
||||
queue.push_back(block.GetHash());
|
||||
}
|
||||
}
|
||||
range.first++;
|
||||
mapBlocksUnknownParent.erase(it);
|
||||
range.first = mapBlocksUnknownParent.erase(range.first);
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
|
|
Loading…
Reference in New Issue