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: Only send fast block anns to full nodes. #2606

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 27, 2021

Fast block announcements were added a few years ago as a way to increase the propagation speed of new blocks that extend the main chain through the network to significantly reduce voting latency as well as how quickly proof-of-work miners discover new blocks. This is desirable behavior, however, it should only apply to full nodes since only they are equipped to deal with the fast announcements.

As a case in point, header commitments and committed block filters can pose a problem for lightweight clients that rely on them in the case of fast block announcements because lightweight clients tend to request the filters as soon as they learn about the new blocks and those filters have not been created yet when fast block announcements are sent.

Since there is network latency involved in the request process, the result is that sometimes the filters are available by the time the requests from lightweight clients are received and sometimes they are not.

In order to help prevent the aforementioned case, and other similar ones, this modifies the code that deals with block announcements to only send fast block announcements to peers that advertise themselves as full nodes instead of all nodes and separates out the block announcement logic slightly to make future enhancements easier in the process.

It also modifies the filtering of duplicate block announcements to work on a per peer basis since not all peers receive the fast block
announcement now.

@davecgh davecgh added this to the 1.7.0 milestone Feb 27, 2021
@davecgh davecgh force-pushed the server_fast_block_relay_to_full_nodes branch from 0324e64 to 7d70d27 Compare February 27, 2021 07:01
Copy link
Member

@rstaudt2 rstaudt2 left a comment

Choose a reason for hiding this comment

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

Looks good to me, just had one question.

server.go Outdated Show resolved Hide resolved
server.go Show resolved Hide resolved
@davecgh davecgh force-pushed the server_fast_block_relay_to_full_nodes branch from 7d70d27 to 3dd7b09 Compare February 27, 2021 18:15
Copy link
Member

@jrick jrick left a comment

Choose a reason for hiding this comment

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

This significantly improves dcrwallet spv (as long as sidechain blocks aren't occurring, which is something we will have to solve separately, and likely in dcrwallet).

Fast block announcements were added a few years ago as a way to increase
the propagation speed of new blocks that extend the main chain through
the network to significantly reduce voting latency as well as how
quickly proof-of-work miners discover new blocks.  This is desirable
behavior, however, it should only apply to full nodes since only they
are equipped to deal with the fast announcements.

As a case in point, header commitments and committed block filters can
pose a problem for lightweight clients that rely on them in the case of
fast block announcements because lightweight clients tend to request the
filters as soon as they learn about the new blocks and those filters
have not been created yet when fast block announcements are sent.

Since there is network latency involved in the request process, the
result is that sometimes the filters are available by the time the
requests from lightweight clients are received and sometimes they are
not.

In order to help prevent the aforementioned case, and other similar
ones, this modifies the code that deals with block announcements to only
send fast block announcements to peers that advertise themselves as full
nodes instead of all nodes and separates out the block announcement
logic slightly to make future enhancements easier in the process.

It also modifies the filtering of duplicate block announcements to work
on a per peer basis since not all peers receive the fast block
announcement now.
@davecgh davecgh force-pushed the server_fast_block_relay_to_full_nodes branch from 3dd7b09 to 53c9e74 Compare March 1, 2021 17:09
@davecgh davecgh merged commit 53c9e74 into decred:master Mar 1, 2021
@davecgh davecgh deleted the server_fast_block_relay_to_full_nodes branch March 1, 2021 17:14
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.

None yet

4 participants