Merge pull request #412 from ConsenSys/address_index_fix

Exclude invalid addresses from search results
pull/414/head
Bernhard Mueller 6 years ago committed by GitHub
commit a5a0e716fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      mythril/leveldb/client.py

@ -190,7 +190,7 @@ class EthLevelDB(object):
def search(self, expression, callback_func): def search(self, expression, callback_func):
''' '''
searches through non-zero balance contracts searches through all contract accounts
''' '''
cnt = 0 cnt = 0
indexer = AccountIndexer(self) indexer = AccountIndexer(self)
@ -202,7 +202,13 @@ class EthLevelDB(object):
try: try:
address = _encode_hex(indexer.get_contract_by_hash(address_hash)) address = _encode_hex(indexer.get_contract_by_hash(address_hash))
except AddressNotFoundError: except AddressNotFoundError:
address = _encode_hex(address_hash) '''
The hash->address mapping does not exist in our index. If the index is up-to-date, this likely means
that the contract was created by an internal transaction. Skip this contract as right now we don't
have a good solution for this.
'''
continue
callback_func(contract, address, balance) callback_func(contract, address, balance)

Loading…
Cancel
Save