mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-13 06:01:45 +00:00
Merge pull request #4656
5cbda4f Changed LevelDB cursors to use scoped pointers to ensure destruction when going out of scope. (Ross Nicoll)
This commit is contained in:
commit
b3ec053082
@ -103,7 +103,7 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CCoinsViewDB::GetStats(CCoinsStats &stats) {
|
bool CCoinsViewDB::GetStats(CCoinsStats &stats) {
|
||||||
leveldb::Iterator *pcursor = db.NewIterator();
|
boost::scoped_ptr<leveldb::Iterator> pcursor(db.NewIterator());
|
||||||
pcursor->SeekToFirst();
|
pcursor->SeekToFirst();
|
||||||
|
|
||||||
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||||
@ -146,7 +146,6 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) {
|
|||||||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete pcursor;
|
|
||||||
stats.nHeight = mapBlockIndex.find(GetBestBlock())->second->nHeight;
|
stats.nHeight = mapBlockIndex.find(GetBestBlock())->second->nHeight;
|
||||||
stats.hashSerialized = ss.GetHash();
|
stats.hashSerialized = ss.GetHash();
|
||||||
stats.nTotalAmount = nTotalAmount;
|
stats.nTotalAmount = nTotalAmount;
|
||||||
@ -178,7 +177,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
|
|||||||
|
|
||||||
bool CBlockTreeDB::LoadBlockIndexGuts()
|
bool CBlockTreeDB::LoadBlockIndexGuts()
|
||||||
{
|
{
|
||||||
leveldb::Iterator *pcursor = NewIterator();
|
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
|
||||||
|
|
||||||
CDataStream ssKeySet(SER_DISK, CLIENT_VERSION);
|
CDataStream ssKeySet(SER_DISK, CLIENT_VERSION);
|
||||||
ssKeySet << make_pair('b', uint256(0));
|
ssKeySet << make_pair('b', uint256(0));
|
||||||
@ -224,7 +223,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||||||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete pcursor;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user