Skip to content

Commit c2ab981

Browse files
Merge pull request #155 from InjectiveLabs/f/fix_sync_timeout_height
chore: fix timeout_height func
2 parents 8aea2c1 + 3532aff commit c2ab981

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyinjective/async_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ async def close_chain_channel(self):
173173
self.cron.stop()
174174

175175
async def sync_timeout_height(self):
176-
block = await self.get_latest_block()
177-
self.timeout_height = block.block.header.height + DEFAULT_TIMEOUTHEIGHT
176+
try:
177+
block = await self.get_latest_block()
178+
self.timeout_height = block.block.header.height + DEFAULT_TIMEOUTHEIGHT
179+
except Exception as e:
180+
logging.debug("error while fetching latest block, setting timeout height to 0:{}".format(e))
181+
self.timeout_height = 0
178182

179183
# cookie helper methods
180184
async def fetch_cookie(self, type):

0 commit comments

Comments
 (0)