txdb: Clean up for loop syntax in `WriteBatchSync`
This commit is contained in:
parent
fb7eb1dad6
commit
a31252a8d8
10
src/txdb.cpp
10
src/txdb.cpp
|
@ -387,14 +387,14 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
|
|||
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<CBlockIndex*>& blockinfo) {
|
||||
MetricsIncrementCounter("zcashd.debug.blocktree.write_batch");
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
|
||||
batch.Write(make_pair(DB_BLOCK_FILES, it->first), *it->second);
|
||||
for (const auto& it : fileInfo) {
|
||||
batch.Write(make_pair(DB_BLOCK_FILES, it.first), *it.second);
|
||||
}
|
||||
batch.Write(DB_LAST_BLOCK, nLastFile);
|
||||
for (std::vector<CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
|
||||
std::pair<char, uint256> key = make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash());
|
||||
for (const auto& it : blockinfo) {
|
||||
std::pair<char, uint256> key = make_pair(DB_BLOCK_INDEX, it->GetBlockHash());
|
||||
try {
|
||||
CDiskBlockIndex dbindex {*it, [this, &key]() {
|
||||
CDiskBlockIndex dbindex {it, [this, &key]() {
|
||||
MetricsIncrementCounter("zcashd.debug.blocktree.write_batch_read_dbindex");
|
||||
// It can happen that the index entry is written, then the Equihash solution is cleared from memory,
|
||||
// then the index entry is rewritten. In that case we must read the solution from the old entry.
|
||||
|
|
Loading…
Reference in New Issue