fix leveldb traversal.

This commit is contained in:
Christopher Jeffrey 2014-11-10 15:36:51 -08:00
parent f057ec71a6
commit 581ff27610
1 changed files with 31 additions and 14 deletions

View File

@ -5739,21 +5739,38 @@ read_addr(const std::string addr) {
continue; continue;
} }
if (cur == NULL) { for (unsigned int vo = 0; vo < ctx.vout.size(); vo++) {
head->ctx = ctx; const CTxOut& txout = ctx.vout[vo];
uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex()); const CScript& scriptPubKey = txout.scriptPubKey;
head->blockhash = hash; int nRequired;
head->next = NULL; txnouttype type;
cur = head; vector<CTxDestination> addresses;
} else { if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
ctx_list *item = new ctx_list(); continue;
item->ctx = ctx; }
uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex()); BOOST_FOREACH(const CTxDestination& address, addresses) {
item->blockhash = hash; if (CBitcoinAddress(address).ToString() != addr) {
item->next = NULL; continue;
cur->next = item; }
cur = item; if (cur == NULL) {
head->ctx = ctx;
uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex());
head->blockhash = hash;
head->next = NULL;
cur = head;
} else {
ctx_list *item = new ctx_list();
item->ctx = ctx;
uint256 hash(((CMerkleTx)ctx).hashBlock.GetHex());
item->blockhash = hash;
item->next = NULL;
cur->next = item;
cur = item;
}
goto found;
}
} }
found:
} }
} }