Merge pull request #598 from rnicoll/1.8-dev-reindex
Close cursor in case of error reading blocks
This commit is contained in:
commit
76a4566be0
|
@ -119,7 +119,7 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
|
|||
}
|
||||
|
||||
bool CCoinsViewDB::GetStats(CCoinsStats &stats) {
|
||||
leveldb::Iterator *pcursor = db.NewIterator();
|
||||
boost::scoped_ptr<leveldb::Iterator> pcursor(db.NewIterator());
|
||||
pcursor->SeekToFirst();
|
||||
|
||||
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||
|
@ -162,7 +162,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) {
|
|||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
}
|
||||
delete pcursor;
|
||||
|
||||
stats.nHeight = mapBlockIndex.find(GetBestBlock())->second->nHeight;
|
||||
stats.hashSerialized = ss.GetHash();
|
||||
stats.nTotalAmount = nTotalAmount;
|
||||
|
@ -194,7 +194,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
|
|||
|
||||
bool CBlockTreeDB::LoadBlockIndexGuts()
|
||||
{
|
||||
leveldb::Iterator *pcursor = NewIterator();
|
||||
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
|
||||
|
||||
CDataStream ssKeySet(SER_DISK, CLIENT_VERSION);
|
||||
uint256 hash;
|
||||
|
@ -255,7 +255,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
}
|
||||
delete pcursor;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue