Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a txn disappears from the blockchain for any reason(invalidated/expiry?/chain reorg) mm2 continues to wait for it to be confirmed and tries to follow the normal swap steps #1442

Closed
gcharang opened this issue Aug 11, 2022 · 4 comments · May be fixed by #2197
Assignees
Labels
bug Something isn't working

Comments

@gcharang
Copy link

Describe the bug
Saw this case with a user selling TKL for KMD

their takerpayment txn was created by mm2. but, for some reason wasn't included in the TKL blockchain. but, mm2 waited till the default time limit to declare the swap as failed:
image

I think, in this particular case, mm2 could have found out that the takerpayment txn has disapperaed and declared the swap as failed/finished and this user's balance updated back to (original - takerFee) much sooner

Can share rest of the screenshots of the swap data in private if necessary

@shamardy
Copy link
Collaborator

shamardy commented Aug 12, 2022

I can see that when waiting for confirmation for UTXOs, if an error is returned while retrieving the transaction, we wait for 15 seconds and then check for the transaction again https://github.com/KomodoPlatform/atomicDEX-API/blob/0f6c7261579ad028b930593c1f2e8a94dca0fced/mm2src/coins/utxo/rpc_clients.rs#L153-L193 Instead we should check the error returned to see if it indicates that the transaction is no longer on-chain and return an error if that's the case.

@borngraced can you please work on this issue next week?

Please also check the wait_for_confirmations functions for coins other than UTXOs and how wait_for_confirmations is used in different places since it should be always called after the transaction is broadcasted to/appears on-chain.

@shamardy
Copy link
Collaborator

shamardy commented Sep 13, 2022

@gcharang I believe it's hard to test if this issue is resolved with the merged PR or not since it rarely happens. I guess If you encounter a swap transaction disappearing again and the swap fails straight away we can consider the issue resolved, otherwise we can wait sometime after a release with this fix and if no users reported this issue again we can also consider it resolved.

@gcharang
Copy link
Author

@shamardy understood and agreed

@sergeyboyko0791
Copy link

There were no problems for 2 months. I think this issue can be considered solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants