-
Notifications
You must be signed in to change notification settings - Fork 292
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
server: Only send fast block anns to full nodes. #2606
Conversation
0324e64
to
7d70d27
Compare
There was a problem hiding this 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.
7d70d27
to
3dd7b09
Compare
There was a problem hiding this 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.
3dd7b09
to
53c9e74
Compare
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.