jl777/SuperNET

fail/cancel message is sent incorrectly for a swap that isn't cancelled

Opened this issue · 2 comments

We came across a bug in mm where it will incorrectly send a failed message telling us a trade has been cancelled when it hasn't. This seems to be what happened:

  • Issue a cancel for a pending trade
  • Cancel command appears to get blocked internally in mm
  • Trade matches
  • We get update events on the progress of the trade
  • Mid trade we get an error event with code -9997 which means a trade has been successfully cancelled
  • Trade was already matched so couldn't actually be cancelled
  • Continue to receive trade progress update events
  • Trade completes successfully

Are you able to looks into this? We are handling it by continuing to listen for messages with the UUID of all trades, even after a cancel event and still updating the UI. However this is extremely confusing for users, the trade will show as pending => matched => swapping => cancelled => swapping => complete.

Swap debug data here:

https://gist.github.com/sindresorhus/b2332c940459aa6c590678854fe1e869

Check ._debug.messages array for a list of all socket messages we recieved in order. Notice the failed event at line 341.

Just got the same issue again and I definitely didn't issue a cancel request. So it seems mm is sending cancel events on its own.

https://gist.github.com/lukechilds/37a8032aa3af04b2bd715d3c1db923f3

Appears the issue sometimes happens with both of these errors: -9998, -9997.