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

peer: Allow OnVersion callback to reject peer. #1250

Merged
merged 3 commits into from
Oct 13, 2018

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Aug 11, 2018

This requires PR #1249.

Backported from decred/dcrd#1251.

This modifies the OnVersion callback to allow a reject message to be returned in which case the message will be sent to the peer and the peer will be disconnected.

This adds a test to ensure duplicate version messages are rejected.

Backported from Decred.
This modifies the negotiation logic to ensure the callback has the
opportunity to see the message before the peer is disconnected and
improves the error handling when reading the remote version message.

It also has the side effect of ensuring the protocol version is
negotiated before sending reject messages with the exception of the
first message not being a version message since negotiation is not
possible in that case.

This is being changed because it is useful for the server to see the
message regardless in order to have the opportunity to things such as
update the address manager and reject peers that don't have desired
services.

Backported from Decred.
This modifies the OnVersion callback to allow a reject message to be
returned in which case the message will be sent to the peer and the peer
will be disconnected.

Backported from Decred.
@davecgh
Copy link
Member Author

davecgh commented Sep 21, 2018

Rebased.

@Roasbeef Roasbeef merged commit 7b103e2 into btcsuite:master Oct 13, 2018
@davecgh davecgh deleted the peer_allow_onversion_reject branch October 13, 2018 00:28
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.

2 participants