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

Print peer order match (and more) #1514

Closed
kilrau opened this issue Apr 29, 2020 · 1 comment · Fixed by #1563
Closed

Print peer order match (and more) #1514

kilrau opened this issue Apr 29, 2020 · 1 comment · Fixed by #1563
Assignees
Labels
enhancement New feature or request P1 top priority

Comments

@kilrau
Copy link
Contributor

kilrau commented Apr 29, 2020

How it is:

In case of own order matches, a match is printed:

matched 0.001 ETH @ 3 with own order 29e3eeb0-8a28-11ea-90cf-439fb244cf44

For peer orders not:

simnet > buy 1 ltc/btc 0.05
swapped 1 LTC with peer order 79d2cd30-8a26-11ea-90cf-439fb244cf44

Which is not consistent and not very good UX since between pressing enter and the result up to 45 seconds can pass without the trader knowing what's going on under the hood.

How it should be:

simnet > buy 1 ltc/btc 0.05
matched 1 LTC @ 0.05 with peer order 79d2cd30-8a26-11ea-90cf-439fb244cf44 (NodeAlias), attempting swap...
successfully swapped 1 LTC with peer order 79d2cd30-8a26-11ea-90cf-439fb244cf44 (NodeAlias)

How it should be (partial success, partial fail)

simnet > buy 1 ltc/btc 0.05
matched 0.5 LTC @ 0.05 with peer order 79d2cd30-8a26-11ea-90cf-439fb244cf44 (NodeAlias), attempting swap...
matched 0.5 LTC @ 0.05 with peer order 72166790-8a27-11ea-9b5f-0b3481cf9ca3 (NodeAlias), attempting swap...
successfully swapped 0.5 LTC with peer order 79d2cd30-8a26-11ea-90cf-439fb244cf44 (NodeAlias)
failed to swap with peer order 72166790-8a27-11ea-9b5f-0b3481cf9ca3 (NodeAlias)
remaining 0.5 LTC entered the order book as 66a79330-8a26-11ea-9b5f-0b3481cf9ca3
@kilrau kilrau added enhancement New feature or request P2 mid priority labels Apr 29, 2020
@kilrau kilrau changed the title Print "Matched with peer order" Print order match Apr 29, 2020
@kilrau kilrau changed the title Print order match Print peer order match Apr 29, 2020
@kilrau
Copy link
Contributor Author

kilrau commented May 7, 2020

Another scenario to cover:

matched with X, swapping
swap failed due to X
continue matching routine
matched with Y, swapping
success

Which happened today:

07/05/2020 10:50:06.371 [RPC] debug: received call /xudrpc.Xud/PlaceOrderSync
07/05/2020 10:50:06.373 [ORDERBOOK] debug: reduced order 3a222f80-904a-11ea-81e2-fbacbf25335a by 5000000 quantity while matching order 835a0640-9050-11ea-8db1-8fc1982a7fbc
07/05/2020 10:50:06.374 [ORDERBOOK] debug: matched with peer 03faf2d11d9ac2e96bd7f8ab27612d1d27abc5bd35b336cd82fd7a59b6e2609efb (DetectSecurity), executing swap on taker 835a0640-9050-11ea-8db1-8fc1982a7fbc and maker 3a222f80-904a-11ea-81e2-fbacbf25335a for 5000000
07/05/2020 10:50:06.399 [BACKUP] debug: xud database changed
07/05/2020 10:50:06.404 [ORDERBOOK] error: swap between orders 3a222f80-904a-11ea-81e2-fbacbf25335a & 835a0640-9050-11ea-8db1-8fc1982a7fbc failed due to SwapClientNotSetup
07/05/2020 10:50:06.405 [ORDERBOOK] warn: swap for 5000000 failed during order matching due to SwapClientNotSetup, will repeat matching routine for failed quantity
07/05/2020 10:50:06.405 [ORDERBOOK] debug: repeating matching routine for 835a0640-9050-11ea-8db1-8fc1982a7fbc for failed quantity of 5000000
07/05/2020 10:50:06.405 [ORDERBOOK] debug: removed order 3a222f80-904a-11ea-81e2-fbacbf25335a while matching order 835a0640-9050-11ea-8db1-8fc1982a7fbc
07/05/2020 10:50:06.405 [ORDERBOOK] debug: matched with peer 03faf2d11d9ac2e96bd7f8ab27612d1d27abc5bd35b336cd82fd7a59b6e2609efb (DetectSecurity), executing swap on taker 835a0640-9050-11ea-8db1-8fc1982a7fbc and maker 3a222f80-904a-11ea-81e2-fbacbf25335a for 5000000
07/05/2020 10:50:06.409 [ORDERBOOK] error: swap between orders 3a222f80-904a-11ea-81e2-fbacbf25335a & 835a0640-9050-11ea-8db1-8fc1982a7fbc failed due to SwapClientNotSetup
07/05/2020 10:50:06.410 [ORDERBOOK] warn: swap for 5000000 failed during order matching due to SwapClientNotSetup, will repeat matching routine for failed quantity
07/05/2020 10:50:06.410 [ORDERBOOK] debug: repeating matching routine for 835a0640-9050-11ea-8db1-8fc1982a7fbc for failed quantity of 5000000
07/05/2020 10:50:06.410 [ORDERBOOK] debug: reduced order 8e7feef0-904a-11ea-8af6-074247cce56f by 5000000 quantity while matching order 835a0640-9050-11ea-8db1-8fc1982a7fbc
07/05/2020 10:50:06.410 [ORDERBOOK] debug: matched with peer 037cba5d492864fc4be82a331e7f1e3ebc7dd11eb9ad7524a4fe98491b01e62bfe (SystemSkull), executing swap on taker 835a0640-9050-11ea-8db1-8fc1982a7fbc and maker 8e7feef0-904a-11ea-8af6-074247cce56f for 5000000
07/05/2020 10:50:06.419 [BACKUP] debug: xud database changed
07/05/2020 10:50:06.424 [SWAPS] debug: New deal: {"takerCltvDelta":40,"rHash":"2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772","orderId":"8e7feef0-904a-11ea-8af6-074247cce56f","pairId":"ETH/BTC","proposedQuantity":5000000,"rPreimage":"cd72e1d00d3effb3d6275694aef7a6e93be9b56b1171af8e15ec592d8c6f750b","takerCurrency":"BTC","makerCurrency":"ETH","takerAmount":105000,"makerAmount":5000000,"takerUnits":105000,"makerUnits":50000000000000000,"destination":"indra5pVhJidXbNbFn8i9EqavUAfGgF8g8cZZ3GscVfb2hUTGRvL2AV","peerPubKey":"037cba5d492864fc4be82a331e7f1e3ebc7dd11eb9ad7524a4fe98491b01e62bfe","localId":"835a0640-9050-11ea-8db1-8fc1982a7fbc","price":0.021,"isBuy":true,"phase":0,"state":0,"role":0,"createTime":1588848606424}
07/05/2020 10:50:06.425 [SWAPS] debug: Requesting deal: {"takerCltvDelta":40,"rHash":"2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772","orderId":"8e7feef0-904a-11ea-8af6-074247cce56f","pairId":"ETH/BTC","proposedQuantity":5000000,"rPreimage":"cd72e1d00d3effb3d6275694aef7a6e93be9b56b1171af8e15ec592d8c6f750b","takerCurrency":"BTC","makerCurrency":"ETH","takerAmount":105000,"makerAmount":5000000,"takerUnits":105000,"makerUnits":50000000000000000,"destination":"indra5pVhJidXbNbFn8i9EqavUAfGgF8g8cZZ3GscVfb2hUTGRvL2AV","peerPubKey":"037cba5d492864fc4be82a331e7f1e3ebc7dd11eb9ad7524a4fe98491b01e62bfe","localId":"835a0640-9050-11ea-8db1-8fc1982a7fbc","price":0.021,"isBuy":true,"phase":0,"state":0,"role":0,"createTime":1588848606424}
07/05/2020 10:50:07.077 [P2P] debug: received swapAccepted from 037cba5d492864fc4be82a331e7f1e3ebc7dd11eb9ad7524a4fe98491b01e62bfe (SystemSkull): {"rHash":"2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772","quantity":5000000,"makerCltvDelta":7022}
07/05/2020 10:50:07.098 [LND-BTC] debug: added invoice of 105000 for 2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772 with cltvExpiry 40
07/05/2020 10:50:07.138 [BACKUP] debug: xud database changed
07/05/2020 10:50:07.154 [BACKUP] debug: xud database changed
07/05/2020 10:50:08.690 [HTTP] debug: http server request json: {"id":"74fe7016-7425-4af6-bd2a-53cf108c74c4","data":{"type":"HashLockTransfer","amount":{"_hex":"0xb1a2bc2ec50000"},"assetId":"0x0000000000000000000000000000000000000000","sender":"indra6bsFmMZeYRrWra1eUj5ai21xkTNdfx58zGmb91QDhGzMcT8HKn","meta":{"recipient":"indra5pVhJidXbNbFn8i9EqavUAfGgF8g8cZZ3GscVfb2hUTGRvL2AV","sender":"indra6bsFmMZeYRrWra1eUj5ai21xkTNdfx58zGmb91QDhGzMcT8HKn","timelock":"7022"},"paymentId":"0x2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772","recipient":"indra5pVhJidXbNbFn8i9EqavUAfGgF8g8cZZ3GscVfb2hUTGRvL2AV","transferMeta":{"expiry":{"_hex":"0x2d98"},"timelock":"7022","lockHash":"0x2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772"}}}
07/05/2020 10:50:08.692 [CONNEXT] warn: received unexpected incoming transfer with rHash 2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772
07/05/2020 10:50:08.927 [RPC] debug: received call /xudrpc.Xud/GetBalance
07/05/2020 10:50:09.136 [RPC] debug: received call /xudrpc.Xud/GetBalance
07/05/2020 10:50:10.592 [SWAPS] debug: Executing taker code to resolve hash
07/05/2020 10:50:10.601 [LND-BTC] debug: settled invoice for 2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772
07/05/2020 10:50:10.602 [SWAPS] debug: Payment received for deal with payment hash cd72e1d00d3effb3d6275694aef7a6e93be9b56b1171af8e15ec592d8c6f750b
07/05/2020 10:50:10.608 [LND-BTC] debug: deleted invoice subscription for 2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772
07/05/2020 10:50:10.630 [BACKUP] debug: xud database changed
07/05/2020 10:50:10.635 [SWAPS] debug: Swap completed. preimage = cd72e1d00d3effb3d6275694aef7a6e93be9b56b1171af8e15ec592d8c6f750b
07/05/2020 10:50:10.653 [BACKUP] debug: xud database changed
07/05/2020 10:50:10.671 [BACKUP] debug: xud database changed
07/05/2020 10:50:10.674 [ORDERBOOK] info: match executed on taker 835a0640-9050-11ea-8db1-8fc1982a7fbc and maker 8e7feef0-904a-11ea-8af6-074247cce56f for 5000000 with peer 037cba5d492864fc4be82a331e7f1e3ebc7dd11eb9ad7524a4fe98491b01e62bfe (SystemSkull)
07/05/2020 10:50:10.685 [BACKUP] debug: xud database changed
07/05/2020 10:50:12.502 [HTTP] debug: http server request json: {"id":"e877ea0f-7fdc-444f-ae43-75be140e52d2","data":{"type":"HashLockTransfer","amount":{"_hex":"0xb1a2bc2ec50000"},"assetId":"0x0000000000000000000000000000000000000000","paymentId":"0x0000000000000000000000000000000000000000000000000000000000000000","sender":"indra6bsFmMZeYRrWra1eUj5ai21xkTNdfx58zGmb91QDhGzMcT8HKn","recipient":"indra5pVhJidXbNbFn8i9EqavUAfGgF8g8cZZ3GscVfb2hUTGRvL2AV","meta":{"sender":"indra6bsFmMZeYRrWra1eUj5ai21xkTNdfx58zGmb91QDhGzMcT8HKn","timelock":"7022","recipient":"indra5pVhJidXbNbFn8i9EqavUAfGgF8g8cZZ3GscVfb2hUTGRvL2AV"},"transferMeta":{"preImage":"0xcd72e1d00d3effb3d6275694aef7a6e93be9b56b1171af8e15ec592d8c6f750b","lockHash":"0x2018f3650b4f1d50d21d9137c1e7c0224173e145fde897d0e836193091068772"}}}
07/05/2020 10:50:13.712 [LND-BTC] debug: new total outbound capacity: 250109997
07/05/2020 10:50:19.521 [RPC] debug: received call /xudrpc.Xud/GetBalance

Output was:

simnet > sell 0.05 eth/btc 0.021
swapped 0.05 ETH with peer order 8e7feef0-904a-11ea-8af6-074247cce56f
failed to swap 0.05 ETH with peer order 3a222f80-904a-11ea-81e2-fbacbf25335a
simnet > 

(I don't understand the order of the prints neither - why the successful swap was printed first)

Output should be:

simnet > sell 0.05 eth/btc 0.021
matched 0.05 ETH with peer order 3a222f80-904a-11ea-81e2-fbacbf25335a (NodeAlias), attempting swap...
failed to swap with peer order 3a222f80-904a-11ea-81e2-fbacbf25335a (NodeAlias), continuing with matching routine...
matched 0.05 ETH with peer order 8e7feef0-904a-11ea-8af6-074247cce56f (NodeAlias), attempting swap...
successfully swapped 0.05 ETH with peer order 8e7feef0-904a-11ea-8af6-074247cce56f (NodeAlias)
simnet > 

@kilrau kilrau added P1 top priority and removed P2 mid priority labels May 7, 2020
@kilrau kilrau changed the title Print peer order match Print peer order match (and more) May 7, 2020
@kilrau kilrau mentioned this issue May 7, 2020
sangaman added a commit that referenced this issue May 15, 2020
This enhances the details returned by the `PlaceOrder` call and output
by the `placeorder` command to include events for when a peer order is
matched and swapping routine begins as well as the alias of the peer
whose order we matched with.
Closes #1514.
sangaman added a commit that referenced this issue May 18, 2020
This enhances the details returned by the `PlaceOrder` call and output
by the `placeorder` command to include events for when a peer order is
matched and swapping routine begins as well as the alias of the peer
whose order we matched with.
Closes #1514.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1 top priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants