This commit is contained in:
jl777
2018-11-25 07:55:17 -11:00
parent e49f46e294
commit 632dac91e6

View File

@@ -424,8 +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; 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,30 +459,23 @@ UniValue CBlockTreeDB::Snapshot(int top)
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();
try try
{ {
/*std::vector<unsigned char> slKey = std::vector<unsigned char>(); std::vector<unsigned char> slKey = std::vector<unsigned char>();
iter->GetKey(slKey); iter->GetKey(slKey);
CDataStream ssKey(slKey, SER_DISK, CLIENT_VERSION); CDataStream ssKey(slKey, SER_DISK, CLIENT_VERSION);
CAddressIndexIteratorKey indexKey; CAddressIndexIteratorKey indexKey;
ssKey >> chType; ssKey >> chType;
ssKey >> indexKey;*/ ssKey >> indexKey;
pair<char, CAddressIndexKey> keyObj; //fprintf(stderr, "chType=%d\n", chType);
iter->GetKey(keyObj);
char chType = keyObj.first;
CAddressIndexKey indexKey = keyObj.second;
fprintf(stderr, "chType=%d vs. %d, %d\n", chType,DB_ADDRESSUNSPENTINDEX,DB_ADDRESSINDEX);
if (chType == DB_ADDRESSUNSPENTINDEX) if (chType == DB_ADDRESSUNSPENTINDEX)
{ {
try { try {
/*std::vector<unsigned char> slValue = std::vector<unsigned char>(); std::vector<unsigned char> slValue = std::vector<unsigned char>();
iter->GetValue(slValue); iter->GetValue(slValue);
CDataStream ssValue(slValue, SER_DISK, CLIENT_VERSION);*/ CDataStream ssValue(slValue, SER_DISK, CLIENT_VERSION);
CAmount nValue; CAmount nValue;
//ssValue >> nValue; ssValue >> nValue;
iter->GetValue(nValue);
getAddressFromIndex(indexKey.type, indexKey.hashBytes, address); getAddressFromIndex(indexKey.type, indexKey.hashBytes, address);