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 bug where peer might not have version info #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dangershony
Copy link
Member

No description provided.

Copy link
Contributor

@MithrilMan MithrilMan left a comment

Choose a reason for hiding this comment

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

did this PR has a linked issue?
I think this is a bad change.

Assuming that the problem is in not having a version info, this should never happen here because you won't have to process any message before you handshake with a peer.
PeerVersion is the version payload that you received from the remote peer, so it will never be null if you handshaked with it

And you shouldn't process anything if you aren't handshaked, so the fix has to be put in another place

Moreover your change would skip the DoS prevention if PeerVersion is null (another reason why I don't like this change)

Anyway try to fix the issue from the right point: you shouldn't process anything except verack and version message before the peer is handshaked.

@dangershony
Copy link
Member Author

yeah I agree I will move the check further up the stack, but I don't have a solid way to reproduce this

@dangershony
Copy link
Member Author

image

image

image

Copy link
Member

@sondreb sondreb left a comment

Choose a reason for hiding this comment

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

I agree with @MithrilMan that this likely should be handled or fixed elsewhere, but it's also possible that it happens during shutdown/dispose that have partially deleted some of the objects? Anyway I think as long as this fixed exceptions/crashes, it's ok to merge.

@dangershony
Copy link
Member Author

but it's also possible that it happens during shutdown/dispose

not in this case it was a running node.

Anyway I think as long as this fixed exceptions/crashes, it's ok to merge.

I will make another change first that is higher up the call chain.

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.

3 participants