fix(legacy-refunds): support going the spending path on refund
This PR attempts to follow a more robust recovery process by attempting both refunding OR spending if the swap goes the ugly way.
This is done by replacing the refund-only logic with refund-or-spend-logic (recovery, recover_funds).
Also recover_funds has been adapted to return more structured error types for information about retrials and such. Also removing some pre-checks that makes us fail early based on local data (e.g. is_swap_finished), as we should still query the rpc to make sure our recovery tx isn't lost or something.
@mariocynicys could you please fix PR lint
- We will need this for TPU, please add it to an issue checklist.
I suppose you're referencing to this issue https://github.com/KomodoPlatform/komodo-defi-framework/issues/1895 ?
We have lots of lists, so I just want to clarify. I also added eth coin todos here.
Moved target for this to 2.4.0-beta release as there will not be enough time to test it for next release.
test_mm2_stops_immediately seems not working btw. I guess clear_running_swaps() is needed here too?
test_mm2_stops_immediately seems not working btw. I guess clear_running_swaps() is needed here too?
yup. I'll just wait till we finish reviewing the mem leak PR and merge it and then merge this with dev.
@mariocynicys pr started to have conflicts
I like this PR. Q: could we extend it for a situation when swap was finished and the taker json has a false MakerPaymentSpendConfirmFailed event (false because in fact the spending tx was confirmed later, after swap was finished) - Maybe add yet another RPC which would check if taker spending tx was eventually confirmed and update the swap events accordingly?