atomicDEX-API icon indicating copy to clipboard operation
atomicDEX-API copied to clipboard

fix(legacy-refunds): support going the spending path on refund

Open mariocynicys opened this issue 1 year ago • 7 comments

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 avatar Nov 25 '24 07:11 mariocynicys

@mariocynicys could you please fix PR lint

laruh avatar Nov 25 '24 11:11 laruh

  • 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.

laruh avatar Dec 05 '24 07:12 laruh

Moved target for this to 2.4.0-beta release as there will not be enough time to test it for next release.

shamardy avatar Dec 09 '24 11:12 shamardy

test_mm2_stops_immediately seems not working btw. I guess clear_running_swaps() is needed here too?

dimxy avatar Jan 14 '25 17:01 dimxy

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 avatar Jan 14 '25 17:01 mariocynicys

@mariocynicys pr started to have conflicts

laruh avatar Jan 16 '25 09:01 laruh

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?

dimxy avatar Nov 03 '25 15:11 dimxy