Codaone / DEXBot

Trading Bot for the BitShares Decentralized Exchange

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

retry_action looses ops when invoked with self.execute

bitphage opened this issue · comments

execute() is broadcasting transactions from current txbuffer, while retry_action() clears txbuffer on retry.

Traceback (most recent call last):
  File "/home/vvk/devel/DEXBot-prod/dexbot/worker.py", line 131, in on_block
    self.workers[worker_name].ontick(data)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.7/site-packages/events/events.py", line 95, in __call__
    f(*a, **kw)
  File "/home/vvk/devel/DEXBot-prod/dexbot/strategies/staggered_orders.py", line 2248, in tick
    self.maintain_strategy()
  File "/home/vvk/devel/DEXBot-prod/dexbot/decorators.py", line 21, in wrapper
    func(self, *args, **kwargs)
  File "/home/vvk/devel/DEXBot-prod/dexbot/strategies/staggered_orders.py", line 197, in maintain_strategy
    trx = self.retry_action(self.execute)
  File "/home/vvk/devel/DEXBot-prod/dexbot/orderengines/bitshares_engine.py", line 692, in retry_action
    return action(*args, **kwargs)
  File "/home/vvk/devel/DEXBot-prod/dexbot/orderengines/bitshares_engine.py", line 510, in execute
    r = self.bitshares.txbuffer.broadcast()
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.7/site-packages/graphenecommon/transactionbuilder.py", line 514, in broadcast
    raise e
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.7/site-packages/graphenecommon/transactionbuilder.py", line 508, in broadcast
    ret, api="network_broadcast"
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.7/site-packages/grapheneapi/api.py", line 176, in func
    self.post_process_exception(e)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.7/site-packages/bitsharesapi/bitsharesnoderpc.py", line 24, in post_process_e
xception
    raise exceptions.UnhandledRPCError(msg)
bitsharesapi.exceptions.UnhandledRPCError: operations.size() > 0: A transaction must have at least one operation
commented

I encountered this issue today when debugging.

Before this, there was a warning retrying on 'Execution error: Assert Exception: now <= trx.expiration:' and then the txbuffer was cleared.

I think we can simply return None when action is self.execute and txbuffer is cleared.