Merge pull request #991 from miketout/dev-komodo
Updated db calls in CBlockTree::Snapshot
This commit is contained in:
16
src/txdb.cpp
16
src/txdb.cpp
@@ -424,7 +424,7 @@ bool getAddressFromIndex(const int &type, const uint160 &hash, std::string &addr
|
|||||||
|
|
||||||
UniValue CBlockTreeDB::Snapshot(int top)
|
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;
|
int64_t utxos = 0; int64_t ignoredAddresses;
|
||||||
boost::scoped_ptr<CDBIterator> iter(NewIterator());
|
boost::scoped_ptr<CDBIterator> iter(NewIterator());
|
||||||
std::map <std::string, CAmount> addressAmounts;
|
std::map <std::string, CAmount> addressAmounts;
|
||||||
@@ -460,22 +460,18 @@ UniValue CBlockTreeDB::Snapshot(int top)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::vector<unsigned char> slKey = std::vector<unsigned char>();
|
std::vector<unsigned char> slKey = std::vector<unsigned char>();
|
||||||
iter->GetKey(slKey);
|
pair<char, CAddressIndexIteratorKey> keyObj;
|
||||||
CDataStream ssKey(slKey, SER_DISK, CLIENT_VERSION);
|
iter->GetKey(keyObj);
|
||||||
CAddressIndexIteratorKey indexKey;
|
|
||||||
|
|
||||||
ssKey >> chType;
|
char chType = keyObj.first;
|
||||||
ssKey >> indexKey;
|
CAddressIndexIteratorKey indexKey = keyObj.second;
|
||||||
|
|
||||||
//fprintf(stderr, "chType=%d\n", chType);
|
//fprintf(stderr, "chType=%d\n", chType);
|
||||||
if (chType == DB_ADDRESSUNSPENTINDEX)
|
if (chType == DB_ADDRESSUNSPENTINDEX)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::vector<unsigned char> slValue = std::vector<unsigned char>();
|
|
||||||
iter->GetValue(slValue);
|
|
||||||
CDataStream ssValue(slValue, SER_DISK, CLIENT_VERSION);
|
|
||||||
CAmount nValue;
|
CAmount nValue;
|
||||||
ssValue >> nValue;
|
iter->GetValue(nValue);
|
||||||
|
|
||||||
getAddressFromIndex(indexKey.type, indexKey.hashBytes, address);
|
getAddressFromIndex(indexKey.type, indexKey.hashBytes, address);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user