From e48af4a18ac71eb2d8798f1ab2c9bba812c48c09 Mon Sep 17 00:00:00 2001 From: miketout Date: Mon, 26 Nov 2018 18:21:30 -0800 Subject: [PATCH] Updated db calls in CBlockTree::Snapshot --- src/txdb.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index cb853331f..212eda7a0 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -424,7 +424,7 @@ bool getAddressFromIndex(const int &type, const uint160 &hash, std::string &addr UniValue CBlockTreeDB::Snapshot(int top) { - char chType; int64_t total = 0; int64_t totalAddresses = 0; std::string address; + int64_t total = 0; int64_t totalAddresses = 0; std::string address; int64_t utxos = 0; int64_t ignoredAddresses; boost::scoped_ptr iter(NewIterator()); std::map addressAmounts; @@ -460,22 +460,18 @@ UniValue CBlockTreeDB::Snapshot(int top) try { std::vector slKey = std::vector(); - iter->GetKey(slKey); - CDataStream ssKey(slKey, SER_DISK, CLIENT_VERSION); - CAddressIndexIteratorKey indexKey; + pair keyObj; + iter->GetKey(keyObj); - ssKey >> chType; - ssKey >> indexKey; + char chType = keyObj.first; + CAddressIndexIteratorKey indexKey = keyObj.second; //fprintf(stderr, "chType=%d\n", chType); if (chType == DB_ADDRESSUNSPENTINDEX) { try { - std::vector slValue = std::vector(); - iter->GetValue(slValue); - CDataStream ssValue(slValue, SER_DISK, CLIENT_VERSION); CAmount nValue; - ssValue >> nValue; + iter->GetValue(nValue); getAddressFromIndex(indexKey.type, indexKey.hashBytes, address);