Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not retry self.execute when txbuffer is cleared #786

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions dexbot/orderengines/bitshares_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,9 @@ def retry_action(self, action, *args, **kwargs):
self.log.warning("Ignoring: '{}'".format(str(exception)))
self.bitshares.txbuffer.clear()
self._account.refresh()
if action == self.execute :
self.log.warning("Cleared txbuffer so unable to retry self.execute")
return None
time.sleep(2)
elif "now <= trx.expiration" in str(exception): # Usually loss of sync to blockchain
if tries > MAX_TRIES:
Expand All @@ -708,6 +711,9 @@ def retry_action(self, action, *args, **kwargs):
tries += 1
self.log.warning("retrying on '{}'".format(str(exception)))
self.bitshares.txbuffer.clear()
if action == self.execute :
self.log.warning("Cleared txbuffer so unable to retry self.execute")
return None
time.sleep(6) # Wait at least a BitShares block
elif "trx.expiration <= now + chain_parameters.maximum_time_until_expiration" in str(exception):
if tries > MAX_TRIES:
Expand All @@ -725,6 +731,9 @@ def retry_action(self, action, *args, **kwargs):
)
self.bitshares.txbuffer.clear()
self.bitshares.rpc.next()
if action == self.execute :
self.log.warning("Cleared txbuffer so unable to retry self.execute")
return None
elif "Assert Exception: delta.amount > 0: Insufficient Balance" in str(exception):
self.log.critical('Insufficient balance of fee asset')
raise
Expand All @@ -741,6 +750,9 @@ def retry_action(self, action, *args, **kwargs):
new = self.bitshares.rpc.url
self.log.info('Old: {}, new: {}'.format(old, new))
tries += 1
if action == self.execute :
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block is probably unnecessary. I'm not sure whether the self.bitshares.clear() code above also clears txbuffer.

self.log.warning("Cleared txbuffer so unable to retry self.execute")
return None
else:
raise

Expand Down