From 2e3586d44a8e918bf898853598afb6e0fdffe1df Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sun, 21 Mar 2021 13:00:58 +0400 Subject: [PATCH] fix: ensure node client supports filters before adding cache middleware --- brownie/network/middlewares/caching.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/brownie/network/middlewares/caching.py b/brownie/network/middlewares/caching.py index e584ddd6c..d379e0dc5 100644 --- a/brownie/network/middlewares/caching.py +++ b/brownie/network/middlewares/caching.py @@ -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