fix leveldb parsing. remove old code.

This commit is contained in:
Christopher Jeffrey 2014-12-01 15:02:58 -08:00
parent 15a694d127
commit af58fbff27

View File

@ -5870,6 +5870,8 @@ read_addr(const std::string addr) {
ctx_list *head = new ctx_list(); ctx_list *head = new ctx_list();
ctx_list *cur = NULL; ctx_list *cur = NULL;
CScript expectedScriptSig = GetScriptForDestination(CBitcoinAddress(addr).Get());
leveldb::Iterator* pcursor = pblocktree->pdb->NewIterator(pblocktree->iteroptions); leveldb::Iterator* pcursor = pblocktree->pdb->NewIterator(pblocktree->iteroptions);
pcursor->SeekToFirst(); pcursor->SeekToFirst();
@ -5883,7 +5885,7 @@ read_addr(const std::string addr) {
char *blockhash_ = strdup(k); char *blockhash_ = strdup(k);
blockhash_++; blockhash_++;
std::string sblockhash = std::string(blockhash_); std::string sblockhash = std::string(blockhash_);
uint256 blockhash(stxhash); uint256 blockhash(sblockhash);
leveldb::Slice slValue = pcursor->value(); leveldb::Slice slValue = pcursor->value();
CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION); CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION);
CBlock cblock; CBlock cblock;
@ -5895,15 +5897,13 @@ read_addr(const std::string addr) {
} }
if (cur == NULL) { if (cur == NULL) {
head->ctx = ctx; head->ctx = ctx;
uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex()); head->blockhash = blockhash;
head->blockhash = hash;
head->next = NULL; head->next = NULL;
cur = head; cur = head;
} else { } else {
ctx_list *item = new ctx_list(); ctx_list *item = new ctx_list();
item->ctx = ctx; item->ctx = ctx;
uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex()); item->blockhash = blockhash;
item->blockhash = hash;
item->next = NULL; item->next = NULL;
cur->next = item; cur->next = item;
cur = item; cur = item;
@ -5925,14 +5925,12 @@ read_addr(const std::string addr) {
} }
if (cur == NULL) { if (cur == NULL) {
head->ctx = ctx; head->ctx = ctx;
//uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex());
head->blockhash = blockhash; head->blockhash = blockhash;
head->next = NULL; head->next = NULL;
cur = head; cur = head;
} else { } else {
ctx_list *item = new ctx_list(); ctx_list *item = new ctx_list();
item->ctx = ctx; item->ctx = ctx;
//uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex());
item->blockhash = blockhash; item->blockhash = blockhash;
item->next = NULL; item->next = NULL;
cur->next = item; cur->next = item;
@ -5945,9 +5943,15 @@ read_addr(const std::string addr) {
} }
found: found:
pcursor->Next(); pcursor->Next();
} catch (std::exception &e) {
// error("%s : Deserialize or I/O error - %s", __func__, e.what());
delete pcursor;
return head;
} }
} }
delete pcursor;
return head; return head;
} }
#endif #endif