Snapshot() reverse iterator

This commit is contained in:
jl777
2018-07-14 23:48:09 -11:00
parent a3b8c12830
commit 48c3fcbed3

View File

@@ -402,7 +402,7 @@ int64_t CBlockTreeDB::Snapshot()
{ {
char chType; int64_t total = -1; std::string address; char chType; int64_t total = -1; std::string address;
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator()); boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
pcursor->SeekToFirst(); pcursor->SeekToLast();
fprintf(stderr,"pcursor iterate\n"); fprintf(stderr,"pcursor iterate\n");
while (pcursor->Valid()) while (pcursor->Valid())
{ {
@@ -428,7 +428,7 @@ int64_t CBlockTreeDB::Snapshot()
total = (int64_t)nValue; total = (int64_t)nValue;
else total += (int64_t)nValue; else total += (int64_t)nValue;
//addressIndex.push_back(make_pair(indexKey, nValue)); //addressIndex.push_back(make_pair(indexKey, nValue));
pcursor->Next(); pcursor->Prev();
} catch (const std::exception& e) { } catch (const std::exception& e) {
return error("failed to get address index value"); return error("failed to get address index value");
} }