Skip to content

Commit

Permalink
short delay before retrying blockheight RPC call
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamISZ committed Dec 19, 2022
1 parent 71898e2 commit 84686b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jmclient/jmclient/wallet_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,10 +808,15 @@ def sync_unspent(self):
# block height needs to be real time for addition to our utxos.
# We are a little aggressive in trying this RPC call, because if
# it fails we cannot continue:
for _ in range(5):
for i in range(5):
current_blockheight = self.bci.get_current_block_height()
if current_blockheight:
break
if i < 4:
jlog.debug("Error calling blockheight RPC, trying again in 0.5s.")
# sync unspent calls are synchronous; this short sleep should
# not affect us since we are not yet in main monitor loop.
time.sleep(0.5)
if not current_blockheight:
# this failure is critical; give up:
jlog.error("Failed to access the current blockheight, "
Expand Down

0 comments on commit 84686b9

Please sign in to comment.