ExchangeUnion / xud

Exchange Union Daemon 🔁 ⚡️
https://exchangeunion.com
GNU Affero General Public License v3.0
115 stars 49 forks source link

removeallorder command may be interrupted by any valid removeorder error #2030

Closed raladev closed 3 years ago

raladev commented 3 years ago

Steps to reproduce:

  1. place buy 0.1 ETH/BTC 0.1 1
  2. make self-match - buy 0.1 ETH/BTC 0.1 2
  3. place several other orders - buy 0.1 ETH/BTC 0.1
  4. removeallorders

Actual result: removeallorders call was interrupted by removing unexisted order (https://github.com/ExchangeUnion/xud/pull/1557) and as a result, other orders were not removed

simnet > sell 0.1 ETH/BTC 0.1 1
remaining 0.1 ETH entered the order book as cd7b7f10-38de-11eb-b217-d34be1dc0c45
no matches found
simnet > buy 0.1 ETH/BTC 0.1 1
6 ALREADY_EXISTS: order with local id 1 already exists
simnet > buy 0.1 ETH/BTC 0.1 2
9 FAILED_PRECONDITION: channel collateralization in progress, please try again in ~1 minute
simnet > buy 0.1 ETH/BTC 0.1 2
matched 0.1 ETH @ 0.1 with own order cd7b7f10-38de-11eb-b217-d34be1dc0c45
simnet > buy 0.1 ETH/BTC 0.1 
remaining 0.1 ETH entered the order book as ddf7c5b0-38de-11eb-b217-d34be1dc0c45
no matches found
simnet > buy 0.1 ETH/BTC 0.1
remaining 0.1 ETH entered the order book as de99ab00-38de-11eb-b217-d34be1dc0c45
no matches found
simnet > buy 0.1 ETH/BTC 0.1
remaining 0.1 ETH entered the order book as df19fe90-38de-11eb-b217-d34be1dc0c45
no matches found
simnet > listorders

Trading pair: ETH/BTC
┌────────────────────────────────────────────────┬────────────────────────────────────────────────┐
│ Buy                                            │ Sell                                           │
├───────────────┬─────────────┬──────────────────┼───────────────┬─────────────┬──────────────────┤
│ Quantity      │ Price       │ Alias            │ Quantity      │ Price       │ Alias            │
├───────────────┼─────────────┼──────────────────┼───────────────┼─────────────┼──────────────────┤
│ 0.1           │ 0.1         │ TellPotato       │               │             │                  │
├───────────────┼─────────────┼──────────────────┼───────────────┼─────────────┼──────────────────┤
│ 0.1           │ 0.1         │ TellPotato       │               │             │                  │
├───────────────┼─────────────┼──────────────────┼───────────────┼─────────────┼──────────────────┤
│ 0.1           │ 0.1         │ TellPotato       │               │             │                  │
└───────────────┴─────────────┴──────────────────┴───────────────┴─────────────┴──────────────────┘

Trading pair: LTC/BTC
┌────────────────────────────────────────────────┬────────────────────────────────────────────────┐
│ Buy                                            │ Sell                                           │
├───────────────┬─────────────┬──────────────────┼───────────────┬─────────────┬──────────────────┤
│ Quantity      │ Price       │ Alias            │ Quantity      │ Price       │ Alias            │
└───────────────┴─────────────┴──────────────────┴───────────────┴─────────────┴──────────────────┘
simnet > removeallorders
Error: 5 NOT_FOUND: order with id cd7b7f10-38de-11eb-b217-d34be1dc0c45 could not be found
simnet > listorders

Trading pair: ETH/BTC
┌────────────────────────────────────────────────┬────────────────────────────────────────────────┐
│ Buy                                            │ Sell                                           │
├───────────────┬─────────────┬──────────────────┼───────────────┬─────────────┬──────────────────┤
│ Quantity      │ Price       │ Alias            │ Quantity      │ Price       │ Alias            │
├───────────────┼─────────────┼──────────────────┼───────────────┼─────────────┼──────────────────┤
│ 0.1           │ 0.1         │ TellPotato       │               │             │                  │
├───────────────┼─────────────┼──────────────────┼───────────────┼─────────────┼──────────────────┤
│ 0.1           │ 0.1         │ TellPotato       │               │             │                  │
├───────────────┼─────────────┼──────────────────┼───────────────┼─────────────┼──────────────────┤
│ 0.1           │ 0.1         │ TellPotato       │               │             │                  │
└───────────────┴─────────────┴──────────────────┴───────────────┴─────────────┴──────────────────┘

Trading pair: LTC/BTC
┌────────────────────────────────────────────────┬────────────────────────────────────────────────┐
│ Buy                                            │ Sell                                           │
├───────────────┬─────────────┬──────────────────┼───────────────┬─────────────┬──────────────────┤
│ Quantity      │ Price       │ Alias            │ Quantity      │ Price       │ Alias            │
└───────────────┴─────────────┴──────────────────┴───────────────┴─────────────┴──────────────────┘
simnet > 

Expected result: removeallorders call can not be interrupted by valid removeorder call errors, but only by assertions.

kilrau commented 3 years ago

This one too? @rsercano

rsercano commented 3 years ago

Yes sure let me check @kilrau