This commit is contained in:
jl777
2018-07-14 23:59:08 -11:00
parent 48c3fcbed3
commit 6651944ae7

View File

@@ -400,7 +400,7 @@ bool getAddressFromIndex(const int &type, const uint160 &hash, std::string &addr
int64_t CBlockTreeDB::Snapshot() int64_t CBlockTreeDB::Snapshot()
{ {
char chType; int64_t total = -1; std::string address; char chType; int64_t total = 0; std::string address;
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator()); boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
pcursor->SeekToLast(); pcursor->SeekToLast();
fprintf(stderr,"pcursor iterate\n"); fprintf(stderr,"pcursor iterate\n");
@@ -428,7 +428,6 @@ 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->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");
} }
@@ -436,6 +435,7 @@ int64_t CBlockTreeDB::Snapshot()
} catch (const std::exception& e) { } catch (const std::exception& e) {
break; break;
} }
pcursor->Prev();
} }
return(total); return(total);
} }