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

server: Reject outbound conns to non-full nodes. #1251

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Aug 11, 2018

This requires PR #1250.

Backported from decred/dcrd#1252.

This modifies the server connection code to reject outbound peers that do not offer full node services.

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.
This modifies the server connection code to reject outbound peers that
do not offer full node services.
@davecgh davecgh force-pushed the server_reject_outbound_peers_without_desired_services branch from b03c7f0 to 9151ebc Compare September 21, 2018 03:30
@davecgh
Copy link
Member Author

davecgh commented Sep 21, 2018

Rebased.

@Roasbeef Roasbeef merged commit 9151ebc into btcsuite:master Oct 13, 2018
@davecgh davecgh deleted the server_reject_outbound_peers_without_desired_services 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