-
Notifications
You must be signed in to change notification settings - Fork 145
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
POST /api/order cancel should include current status #1311
Comments
This is a great solution to the problem 👍 It is rare, but it can happen in our official client that a maker cancels the order while still public and by the time the request hits, a taker has shown up, therefore making the maker lose his bond without any previous notification and no recourse. Implementing this fix on the backend and client is rewarded with ⚡ 100K Sats ⚡ (60K Sats for a PR with a backend only fix, and 30K Sats for a PR with client only fix) |
@Reckless-Satoshi I think I can start working on this, could you assign me? |
Hello @aftermath2, I have made a PR that implements this fix on the backend. I am not familiar with frontend sutff, you can work on the frontend if you want. |
@jerryfletcher21 I've already made the changes to the backend and frontend (PR), sorry I didn't know you were working on it. |
@aftermath2 ah that is a bit unfortunate that we both worked at the backed. Let's wait for @Reckless-Satoshi's feedbacks and then we may do a a single pull requests. |
@Reckless-Satoshi Just rebased to main to pull the latest changes, resolved a conflict and ran the tests. I think the issue is ready to review, let me know if there are further changes needed. |
Describe the bug
It is not a bug, it is a security improvement (for the client).
When a POST requests is make to
/api/order
withaction
cancel
, the order is cancelled. Depending on the current status of the order, a penalty may be inflicted on the canceller. The point is that the client can not be 100% percent sure that the current status of the order is the one it think it is. A public order may for example have been taken after the last request of the client to get the current status.By adding a new parameter in the requests, (
current_status
for example), the client specifes the status in which it wants to cancel the offer. The server then proceeds in cancelling the offer just if the current status is the one specified in the request, if not it simply returns an error saying that current status is not the correct one.To Reproduce
Make a POST requsts at /api/order with
action
cancel
Expected behavior
Prevent the client from cancelling an offer in the wrong status
The text was updated successfully, but these errors were encountered: