coblox / bobtimus

an autobot that automatically handles swaps as Bob
Apache License 2.0
1 stars 1 forks source link

Trigger refund if possible #58

Closed da-kami closed 5 years ago

da-kami commented 5 years ago

fixes #20

thomaseizinger commented 5 years ago

can we do a test with the ethereum node to confirm the wait logic?

@D4nte That is pretty hard though to do "properly" and I am not sure if that is worth it compared to a unit test for the wait logic.

  1. Create a very simply Ethereum transaction (probably a contract deployment that fails because of timestamp)
  2. Send it against the node and mine it
  3. Verify in the receipt that the TX failed
  4. Wait for the timestamp to pass
  5. Create a 2nd transaction with the same data
  6. Send it to the node again and mine it
  7. Verify in the receipt that the TX execution now successful

To me, that seems be a bit overkill and testing the wait function in a unit test would be sufficient.

D4nte commented 5 years ago

Ok, LGTM, can we plan to actually test it live at some point then?

da-kami commented 5 years ago

The refund should not be triggered (wasting gas on Ethereum?) if the swap is complete?

Conclusion after discussion: No changes (Trigger the refund every time, ignore wasted money.)

The problem is, that it is not trivial to know if refund is actually still available. We would have to send another request to the comit-node in order to be sure if the action is still available. This goes against the principles currently implemented in bobtimus - and eventually the comit-node will handle the expiry, see https://github.com/comit-network/comit-rs/issues/1075

Note: In the current code, there is no error/warning emitted when the execution of a LedgerAction returns an error. There is only debug information logged.