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

What does the output of the cancel command mean. #844

Open
lukechilds opened this issue May 17, 2018 · 4 comments
Open

What does the output of the cancel command mean. #844

lukechilds opened this issue May 17, 2018 · 4 comments

Comments

@lukechilds
Copy link
Contributor

lukechilds commented May 17, 2018

Related: atomiclabs/hyperdex#129

We're trying to add a cancel button to allow users to panic cancel incorrect trades.

If the trade hasn't been matched yet it normally works fine and we get:

{result: "success", numentries: 1, status: "uuid canceled"}

And a failed message is sent over the socket so we can correctly update our UI.


If we cancel as soon as it's been matched but before any TXs have been sent we get:

{result: "success", numentries: 1, status: "will stop trade negotiation, but if swap started it wont cancel"}

The swap never normally cancels at this point. Should it? When is a swap considered "started"? After being matched or after the first TX.

And what does stopping trade negotiation mean? Is there any way for us to check if the negotiation has been stopped so we can update the UI and say it's no longer pending/matched? Should we get a failed event over the socket in this scenario if the negotiation is stopped?


Cancelling again right after the first TX has been sent will return:

{result: "success", numentries: 0, status: "will stop trade negotiation, but if swap started it wont cancel"}

(same response but numentries is now 0)

What is numentries referring to? Whether or not the swap has already started?


I understand swaps shouldn't and won't be cancelled after they've started. But I'm not sure exactly when that is. We need a way to reliably determine from the response whether the swap will continue or be stopped so we can update the UI to notify the user.

@jl777
Copy link
Owner

jl777 commented May 17, 2018

there are internal entries for a swap in progress. there can be more than one, ie. request, reserved, connect, connected.

so if numentries is 0, then it is likely already moved onto a DB/SWAPS swap
if it is 1, then very good that it was stopped

all this is very edge casey... to be sure the swap status needs to be issued to see what the swapstatus is

@lukechilds
Copy link
Contributor Author

all this is very edge casey... to be sure the swap status needs to be issued to see what the swapstatus is

Can we also rely on socket messages or would that be subject to edgecases too and we should fall back to swapstatus?

if it is 1, then very good that it was stopped

But it only does that before it's matched (connected message), after that but before the first TX numentries is still 1. Should this be cancellable or not?

@jl777
Copy link
Owner

jl777 commented May 17, 2018

it is unpredictable. it is doing the best it can to stop the swap. i think the best way is to do a swapstatus and make sure it doesnt advance. lack of activity is the only proof that the swap is stopped

@lukechilds
Copy link
Contributor Author

Ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants