Skip to content

Commit

Permalink
Merge pull request #1009 from eth-brownie/fix-caching-filter
Browse files Browse the repository at this point in the history
Ensure node client supports filters before adding cache middleware
  • Loading branch information
iamdefinitelyahuman authored Mar 21, 2021
2 parents 3aea24c + 2e3586d commit ce603c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions brownie/network/middlewares/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ def __init__(self, w3: Web3) -> None:
@classmethod
def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]:
if network_type == "live":
try:
# ensure that the node client supports filters
block_filter = w3.eth.filter("latest")
block_filter.get_new_entries()
except ValueError:
return None
return 0
else:
return None
Expand Down

0 comments on commit ce603c5

Please sign in to comment.