coblox / bobtimus

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

Implement Refund logic and action #20

Closed D4nte closed 5 years ago

D4nte commented 5 years ago

If a refund action is present and it is possible to trigger it, do it, else, do the other available action.

Get inspired by comit-rs e2e tests.

The motivation is that if you reach a point where refund is possible we give up on the swap and do a refund. However the comit_node will return the refund action as soon as an asset is funded. To know if refund is possible we need to check the blockchain times, this is done differently on different blockchains.

"it is possible to trigger it": you need to ask the blockchain node what time it is. Note that we use absolute unix time for expiry.

If the refund fails: