Skip to content

Commit 214914f

Browse files
committed
v0.1.42 stop logging when SubSquid has not indexed to the requested block and get_logs falls back to RPC.
1 parent ba6c8d0 commit 214914f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

IceCreamSwapWeb3/EthAdvanced.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ def get_logs(
195195
return results
196196
return results + self.get_logs({**filter_params, "fromBlock": till_block + 1}, **kwargs)
197197
except Exception as e:
198-
print(f"Getting logs from SubSquid threw exception {repr(e)}, falling back to RPC")
198+
if not isinstance(e, ValueError) or "Subsquid only has indexed till block " not in str(e):
199+
print(f"Getting logs from SubSquid threw exception {repr(e)}, falling back to RPC")
199200

200201
last_stable_block = self.w3.latest_seen_block - self.w3.unstable_blocks
201202
if get_logs_by_block_hash or to_block > last_stable_block:

IceCreamSwapWeb3/Subsquid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_filter(
5353
latest_block = get_latest_subsquid_block(gateway_url)
5454

5555
if from_block > latest_block:
56-
raise ValueError(f"Subsquid has only indexed till block {latest_block}")
56+
raise ValueError(f"Subsquid only has indexed till block {latest_block}")
5757

5858
if to_block > latest_block:
5959
if partial_allowed:

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.41'
3+
VERSION = '0.1.42'
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)