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

p2p/discovery: Workaround a parity bug that causes pongs with wrong token #1011

Merged
merged 1 commit into from
Jul 16, 2018

Conversation

gsalgado
Copy link
Contributor

Parity 1.10 (and earlier) nodes send the wrong token on pong messages
(openethereum/parity-ethereum#8038). This change keeps
a mapping of wrong tokens to the ones we expect, and uses that whenever
we get a pong with one of those wrong tokens.

@gsalgado gsalgado requested a review from pipermerriam July 13, 2018 15:36
Copy link
Contributor

@carver carver left a comment

Choose a reason for hiding this comment

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

Nice hunt-down of the parity bug. Too bad it's required, but hopefully it won't need to stay for long.

p2p/kademlia.py Outdated
parity_token = k
break
if parity_token is not None:
del self.parity_pong_tokens[parity_token]
Copy link
Contributor

Choose a reason for hiding this comment

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

Another option if you like it better:

token_pairs = cytoolz.valfilter(lambda val: val == token, self.parity_pong_tokens)
for parity_token, _token in token_pairs:
    del self.parity_pong_tokens[parity_token]

Copy link
Member

@pipermerriam pipermerriam Jul 13, 2018

Choose a reason for hiding this comment

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

How about just:

for k, v in tuple(self.parity_pong_tokens.items()):
    if v == token:
        del self.parity_pong_tokens[k]
        break

Copy link
Member

Choose a reason for hiding this comment

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

or a one-liner

self.parity_pong_tokens = cytoolz.valfilter(lambda val: val != token, self.parity_pong_tokens)

…oken

Parity 1.10 (and earlier) nodes send the wrong token on pong messages
(openethereum/parity-ethereum#8038). This change keeps
a mapping of wrong tokens to the ones we expect, and uses that whenever
we get a pong with one of those wrong tokens.
@gsalgado gsalgado merged commit 3b6c1df into ethereum:master Jul 16, 2018
@gsalgado gsalgado mentioned this pull request Sep 14, 2018
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

Successfully merging this pull request may close these issues.

4 participants