From b5e7d1c5de7cdbb95ed57ee6094a106bdd5c4fa4 Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Sun, 5 Aug 2018 13:03:22 +0700 Subject: [PATCH] Exclude invalid addresses from search results --- mythril/leveldb/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mythril/leveldb/client.py b/mythril/leveldb/client.py index daa3b528..210b647f 100644 --- a/mythril/leveldb/client.py +++ b/mythril/leveldb/client.py @@ -190,7 +190,7 @@ class EthLevelDB(object): def search(self, expression, callback_func): ''' - searches through non-zero balance contracts + searches through all contract accounts ''' cnt = 0 indexer = AccountIndexer(self) @@ -202,7 +202,13 @@ class EthLevelDB(object): try: address = _encode_hex(indexer.get_contract_by_hash(address_hash)) 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)