File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 33these are not present in btsdk but are required for e2e tests
44"""
55
6+ import time
67import asyncio
78import contextlib
89from typing import Union , Optional , TYPE_CHECKING
@@ -160,22 +161,25 @@ async def use_and_wait_for_next_nonce(
160161
161162 yield
162163
163- async def wait_for_new_nonce ():
164+ def wait_for_new_nonce ():
165+ now = time .time ()
164166 while nonce == subtensor .substrate .get_account_next_index (
165167 wallet .hotkey .ss58_address
166168 ):
169+ if time .time () - now > timeout :
170+ raise TimeoutError (f"Timeout waiting for new nonce." )
167171 logging .console .info (
168172 f"Waiting for new nonce. Current nonce: { nonce } for wallet { wallet .hotkey .ss58_address } "
169173 )
170- await asyncio .sleep (sleep )
174+ time .sleep (sleep )
171175
172176 # give the chain 3 tries to reveal a new nonce after latest extrinsic call
173177 max_retries = 3
174178 for attempt in range (max_retries ):
175179 try :
176- await asyncio . wait_for ( wait_for_new_nonce (), timeout )
180+ wait_for_new_nonce ()
177181 break
178- except asyncio . TimeoutError :
182+ except TimeoutError :
179183 logging .warning (f"Attempt { attempt + 1 } of { max_retries } timed out." )
180184 if attempt + 1 == max_retries :
181185 raise
You can’t perform that action at this time.
0 commit comments