Minor bugfixes
Was "Handle obfuscation in CLevelDBIterator" Zcash: Only bugfixes
This commit is contained in:
committed by
Jack Grigg
parent
1ebf50b6da
commit
0d9524ba6b
@@ -95,7 +95,7 @@ bool CLevelDBWrapper::IsEmpty()
|
|||||||
it->SeekToFirst();
|
it->SeekToFirst();
|
||||||
return !(it->Valid());
|
return !(it->Valid());
|
||||||
}
|
}
|
||||||
|
|
||||||
CLevelDBIterator::~CLevelDBIterator() { delete piter; }
|
CLevelDBIterator::~CLevelDBIterator() { delete piter; }
|
||||||
bool CLevelDBIterator::Valid() { return piter->Valid(); }
|
bool CLevelDBIterator::Valid() { return piter->Valid(); }
|
||||||
void CLevelDBIterator::SeekToFirst() { piter->SeekToFirst(); }
|
void CLevelDBIterator::SeekToFirst() { piter->SeekToFirst(); }
|
||||||
|
|||||||
@@ -67,7 +67,12 @@ private:
|
|||||||
leveldb::Iterator *piter;
|
leveldb::Iterator *piter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLevelDBIterator(leveldb::Iterator *piterIn) : piter(piterIn) {}
|
|
||||||
|
/**
|
||||||
|
* @param[in] piterIn The original leveldb iterator.
|
||||||
|
*/
|
||||||
|
CLevelDBIterator(leveldb::Iterator *piterIn) :
|
||||||
|
piter(piterIn) { };
|
||||||
~CLevelDBIterator();
|
~CLevelDBIterator();
|
||||||
|
|
||||||
bool Valid();
|
bool Valid();
|
||||||
@@ -229,7 +234,7 @@ public:
|
|||||||
CLevelDBIterator *NewIterator()
|
CLevelDBIterator *NewIterator()
|
||||||
{
|
{
|
||||||
return new CLevelDBIterator(pdb->NewIterator(iteroptions));
|
return new CLevelDBIterator(pdb->NewIterator(iteroptions));
|
||||||
{
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the database managed by this class contains no entries.
|
* Return true if the database managed by this class contains no entries.
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
|
|||||||
/* It seems that there are no "const iterators" for LevelDB. Since we
|
/* It seems that there are no "const iterators" for LevelDB. Since we
|
||||||
only need read operations on it, use a const-cast to get around
|
only need read operations on it, use a const-cast to get around
|
||||||
that restriction. */
|
that restriction. */
|
||||||
boost::scoped_ptr<CLevelDBWrapper> pcursor(const_cast<CLevelDBWrapper*>(&db)->NewIterator());
|
boost::scoped_ptr<CLevelDBIterator> pcursor(const_cast<CLevelDBWrapper*>(&db)->NewIterator());
|
||||||
pcursor->Seek('c');
|
pcursor->Seek('c');
|
||||||
|
|
||||||
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||||
@@ -249,9 +249,9 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
|
|||||||
|
|
||||||
bool CBlockTreeDB::LoadBlockIndexGuts()
|
bool CBlockTreeDB::LoadBlockIndexGuts()
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
|
boost::scoped_ptr<CLevelDBIterator> pcursor(NewIterator());
|
||||||
|
|
||||||
pcursor->Seek(make_pair('b', uint256(0)));
|
pcursor->Seek(make_pair('b', uint256()));
|
||||||
|
|
||||||
// Load mapBlockIndex
|
// Load mapBlockIndex
|
||||||
while (pcursor->Valid()) {
|
while (pcursor->Valid()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user