typedef std::map<uint256, CCoins> to CCoinsMap

This makes it possible to switch to a more efficient map type
without changing all occurences manually.

Merges half of #4413.
This commit is contained in:
Wladimir J. van der Laan
2014-06-25 13:45:29 +02:00
parent 8d9cc7d743
commit dd638dd712
4 changed files with 17 additions and 16 deletions

View File

@@ -54,11 +54,11 @@ bool CCoinsViewDB::SetBestBlock(const uint256 &hashBlock) {
return db.WriteBatch(batch);
}
bool CCoinsViewDB::BatchWrite(const std::map<uint256, CCoins> &mapCoins, const uint256 &hashBlock) {
bool CCoinsViewDB::BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock) {
LogPrint("coindb", "Committing %u changed transactions to coin database...\n", (unsigned int)mapCoins.size());
CLevelDBBatch batch;
for (std::map<uint256, CCoins>::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++)
for (CCoinsMap::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++)
BatchWriteCoins(batch, it->first, it->second);
if (hashBlock != uint256(0))
BatchWriteHashBestChain(batch, hashBlock);