Skip to content

Commit 790977a

Browse files
committed
v0.1.50 hopefully improved handling of empty block responses
1 parent 064c894 commit 790977a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

IceCreamSwapWeb3/BatchRetryMiddleware.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from time import sleep
22

3+
from web3.manager import NULL_RESPONSES
34
from web3.middleware import Web3Middleware
45

56
from IceCreamSwapWeb3 import Web3Advanced
@@ -50,7 +51,13 @@ def request_wrapper(method, params):
5051
requests_retry = []
5152
request_indexes: list[tuple[int, int]] = []
5253
for i, (request_single, response_single) in enumerate(zip(requests_info, response)):
53-
if "error" in response_single or response_single.get("result") is None:
54+
if (
55+
"error" in response_single or
56+
(
57+
"eth_getBlockBy" in request_single[0] and
58+
response_single.get("result") in NULL_RESPONSES
59+
)
60+
):
5461
request_indexes.append((i, len(requests_retry)))
5562
requests_retry.append(request_single)
5663

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup, find_packages
22

3-
VERSION = '0.1.49'
3+
VERSION = '0.1.50'
44
DESCRIPTION = 'IceCreamSwap Web3.py wrapper'
55
LONG_DESCRIPTION = 'IceCreamSwap Web3.py wrapper with automatic retries, multicall and other advanced functionality'
66

0 commit comments

Comments
 (0)