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

fix: added check for peer's pairs on order invalidation #1864

Closed
wants to merge 6 commits into from

Conversation

rsercano
Copy link
Collaborator

@rsercano rsercano commented Sep 3, 2020

attempts to fix #1530

Not sure if there's any other order event to check, also it would be great if you can tell me if I have to check pair's active status before emitting the event.

@rsercano rsercano self-assigned this Sep 3, 2020
@rsercano rsercano requested a review from sangaman September 3, 2020 13:58
@rsercano rsercano added the p2p Peer to peer networking label Sep 3, 2020
@raladev raladev self-requested a review September 3, 2020 14:35
Copy link
Collaborator

@sangaman sangaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this, it's a minor fix but makes sense and will make the logs cleaner.

lib/p2p/Pool.ts Outdated Show resolved Hide resolved
lib/p2p/Pool.ts Outdated Show resolved Hide resolved
lib/p2p/Pool.ts Outdated Show resolved Hide resolved
lib/p2p/Pool.ts Outdated Show resolved Hide resolved
@sangaman sangaman added the logging Log messages and output label Sep 3, 2020
@raladev
Copy link
Contributor

raladev commented Sep 4, 2020

04/09/2020 13:07:09.941 [P2P] verbose: received node state update packet from 03bdf0e1b1338711cd4374802b6467793fe455f3c7adfd67935e1822c7d12cfc16 (DawnAerobic): {"pairs":["ETH/BTC","LTC/BTC","LTC/USDT","BTC/USDT","USDT/ETH"],"addresses":[{"host":"7w6fk4s6tvpsnesw55voeluvruv3kxtbgdk3gacydcl6wekndns5x7ad.onion","port":28885}],"connextIdentifier":"indra6Wt45v28puTyh5A5dpLJmW8kNfss8vQeS5zGCLNWSUY4tDHDfg","lndPubKeys":{"BTC":"02cbeda716bb4d455f4d45decac5f58b47f46bd2b8dd15951ed63c5413065a697d","LTC":"02cbeda716bb4d455f4d45decac5f58b47f46bd2b8dd15951ed63c5413065a697d"},"lndUris":{"BTC":["02cbeda716bb4d455f4d45decac5f58b47f46bd2b8dd15951ed63c5413065a697d@ue36scvguve6rthvrdwxjsn4fru266ggyvyamotmqrzpgt24p3ip3hqd.onion:29735"],"LTC":["02cbeda716bb4d455f4d45decac5f58b47f46bd2b8dd15951ed63c5413065a697d@wuqkkmuthtmzlvity5g2mwvcqgvccuxyta4asadrldgd6z4exlnya7ad.onion:30735"]},"tokenIdentifiers":{"BTC":"bitcoin-simnet","ETH":"0x0000000000000000000000000000000000000000","LTC":"litecoin-simnet","USDT":"0x61F6b6D86E29fC62224943583F97966F093cC94D"}}


04/09/2020 13:07:09.942 [P2P] trace: Sent Get Orders packet to 03bdf0e1b1338711cd4374802b6467793fe455f3c7adfd67935e1822c7d12cfc16 (DawnAerobic): "{\"body\":{\"pairIds\":[\"USDT/ETH\"]},\"header\":{\"id\":\"8a8d3960-eeaf-11ea-8df1-fd04cc7ae94a\"}}"



04/09/2020 13:07:10.471 [P2P] trace: Received Orders packet from 03bdf0e1b1338711cd4374802b6467793fe455f3c7adfd67935e1822c7d12cfc16 (DawnAerobic): "{\"body\":[],\"header\":{\"id\":\"8abfe220-eeaf-11ea-8d17-c395fd7a8440\",\"reqId\":\"8a8d3960-eeaf-11ea-8df1-fd04cc7ae94a\"}}"
04/09/2020 13:07:10.472 [P2P] verbose: received 0 orders from 03bdf0e1b1338711cd4374802b6467793fe455f3c7adfd67935e1822c7d12cfc16 (DawnAerobic)
  • after adding new pair, the peer with new pair sends packet update to his peers. And after that these peers send GetOrders packet to this peer even if they have no this pair. It would be good to not ask orders if we have no this new pair.
    Should we create new issue or we can fix it it this PR? @rsercano @kilrau

  • Also it would be good to send GetOrders packet from peer that added pair (if remote peer has this pair). It will help to fix this issue - No active orders from peers after adding new pair #1538

Copy link
Contributor

@raladev raladev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above

@sangaman
Copy link
Collaborator

sangaman commented Sep 4, 2020

* [ ]  Also it would be good to send GetOrders packet from peer that added pair (if remote peer has this pair). It will help to fix this issue - #1538

I would do this in a separate PR, although this is a good idea. Just don't want this one to get too big or complicated.

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 5, 2020

after adding new pair, the peer with new pair sends packet update to his peers. And after that these peers send GetOrders packet to this peer even if they have no this pair. It would be good to not ask orders if we have no this new pair.
Should we create new issue or we can fix it it this PR? @rsercano @kilrau

Alight, I'll check this point within this PR.

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 5, 2020

I added a new check as per @raladev's request, now we won't send NodeStateUpdate packet when adding/removing a pair if this pair is not active in the peer.

@raladev
Copy link
Contributor

raladev commented Sep 7, 2020

I added a new check as per @raladev's request, now we won't send NodeStateUpdate packet when adding/removing a pair if this pair is not active in the peer.

Not sure that it is correct fix, we still want to get info about pairs that we dont have, but we dint need info about orders. So, more correct would be remove GetOrders call in this case

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 7, 2020

I added a new check as per @raladev's request, now we won't send NodeStateUpdate packet when adding/removing a pair if this pair is not active in the peer.

Not sure that it is correct fix, we still want to get info about pairs that we dont have, but we dint need info about orders. So, more correct would be remove GetOrders call in this case

I see, let me check it this way then

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 7, 2020

fixed

@raladev
Copy link
Contributor

raladev commented Sep 7, 2020

fixed

but i still dont see the code for handling of GetOrders autocall on remote peer side.
It seems u just returned UpdatePacket without GetOrders handling.
Will test.

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 7, 2020

I thought this would be sufficient https://github.com/ExchangeUnion/xud/pull/1864/files#diff-1934dba4817446d9f1708503332eb124R731

@kilrau kilrau requested review from sangaman and raladev September 7, 2020 11:33
@raladev
Copy link
Contributor

raladev commented Sep 7, 2020

I thought this would be sufficient https://github.com/ExchangeUnion/xud/pull/1864/files#diff-1934dba4817446d9f1708503332eb124R731

  • still see GetOrders packet sending :(
    Screenshot from 2020-09-07 17-09-48

Copy link
Contributor

@raladev raladev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 8, 2020

Alright let me recheck

sangaman
sangaman previously approved these changes Sep 10, 2020
Copy link
Collaborator

@sangaman sangaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Let's handle the GetOrders packet in another PR, I think the change here can stand on its own and fixes the behavior with the order invalidation packets that are mentioned in the original issue.

@sangaman
Copy link
Collaborator

See #1884 which addresses your requested changes @raladev - would you mind approving this PR so we can merge these separately?

@raladev raladev self-requested a review September 10, 2020 08:48
raladev
raladev previously approved these changes Sep 10, 2020
@rsercano rsercano dismissed stale reviews from raladev and sangaman via 7e4b491 September 10, 2020 12:23
@rsercano rsercano force-pushed the order-invalidation-fix branch 4 times, most recently from 8bd9f06 to 88f38f3 Compare September 10, 2020 12:31
@rsercano rsercano force-pushed the order-invalidation-fix branch from 88f38f3 to 822418a Compare September 10, 2020 12:37
Copy link
Collaborator

@sangaman sangaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we didn't want to mess with nodestateupdate packets in this PR? I was ready to merge this before the most recent commit. Let's try to keep the scope of PRs small and manageable, we can open separate PRs for separate issues.

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 10, 2020

I thought we didn't want to mess with nodestateupdate packets in this PR? I was ready to merge this before the most recent commit. Let's try to keep the scope of PRs small and manageable, we can open separate PRs for separate issues.

No no I didn't mean to mess with it, could you please check "files changed", I just was trying to sign the previous commits to make them mergeable.

@raladev raladev self-requested a review September 10, 2020 12:55
@raladev
Copy link
Contributor

raladev commented Sep 10, 2020

I thought we didn't want to mess with nodestateupdate packets in this PR? I was ready to merge this before the most recent commit. Let's try to keep the scope of PRs small and manageable, we can open separate PRs for separate issues.

822418a is just a revert of 7b7e7fc

@raladev raladev requested a review from sangaman September 10, 2020 13:28
@raladev raladev dismissed sangaman’s stale review September 10, 2020 13:29

last commit is revert of not worked fix for GetOrder

@kilrau
Copy link
Contributor

kilrau commented Sep 10, 2020

Merging is still blocked, because previous commits were not signed. Maybe you can squash commits into one first, then sign and force push to this branch. That should do the trick. @rsercano

@sangaman
Copy link
Collaborator

No no I didn't mean to mess with it, could you please check "files changed", I just was trying to sign the previous commits to make them mergeable.

Got it, sorry that commit just confused me. So the current changes look good to me, if you can squash and sign these commits like kilrau said that would be great. Otherwise I can do it sometime tomorrow.

@rsercano
Copy link
Collaborator Author

I'm opening a new one #1890 sorry for the confusion, squashing looks like a pain since there're several commits between my commits, or Im literally too bad to do it!

@rsercano rsercano closed this Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging Log messages and output p2p Peer to peer networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xud processing order updates for pairs I do not have
4 participants