-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Limit the number of addressses for broadcast to accumulate #5419
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
ACK. |
src/net.h
Outdated
Member
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.
I suppose insecure_rand is good enough here? GetRand can be slow.
Member
Author
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.
Done.
Member
|
Needs backport to 0.9 as well |
laanwj
added a commit
that referenced
this pull request
Dec 5, 2014
12a49ca Limit the number of new addressses to accumulate (Pieter Wuille)
mzumsande
added a commit
to mzumsande/bitcoin
that referenced
this pull request
Sep 3, 2020
`fGetAddr` is an old flag that indicates an ongoing GETADDR/ADDR interaction. Introduced in dd51920, it prevents further relay of received ADDR answers to other peers via the `RelayAddress()` gossip mechanism while set - probably to prevent ADDR traffic from being dominated by large GETADDR answers. It also used to be possible to receive a large GETADDR answer spread over multiple ADDR messages (each bounded to max 1000 addresses), so the condition `if (vAddr.size() < 1000) pfrom.fGetAddr = false;` was meant to ensure that `fGetAddr` would only get cleared once the last ADDR of the package was received (typically with < 1000 addresses). However, `fGetAddr` is no longer useful for two reasons: - 5cbf753 introduced the condition `vAddr.size() <= 10`, so messages with more than 10 elements won't be relayed further regardless. - since bitcoin#5419, we do not get more than one ADDR message in response to GETADDR because `vAddrToSend` cannot have more than 1000 elements. Removing the flag will change behaviour in two special cases: 1.) If the GETADDR response is exactly of size 1000, `fGetAddr` will not not be cleared on current master, so that the next "regular" ADDR message by this peer won't be relayed - this does not seem intentional, changing it arguably fixes a bug. 2.) If the response to GETADDR is small (<=10 addresses), it will be relayed to peers just as any other ADDR message of that size.
mzumsande
added a commit
to mzumsande/bitcoin
that referenced
this pull request
Sep 6, 2020
`fGetAddr` is an old flag that indicates an ongoing GETADDR/ADDR interaction. Introduced in dd51920, it prevents further relay of received ADDR answers to other peers via the `RelayAddress()` gossip mechanism while set - probably to prevent ADDR traffic from being dominated by large GETADDR answers. It also used to be possible to receive a large GETADDR answer spread over multiple ADDR messages (each bounded to max 1000 addresses), so the condition `if (vAddr.size() < 1000) pfrom.fGetAddr = false;` was meant to ensure that `fGetAddr` would only get cleared once the last ADDR of the package was received (typically with < 1000 addresses). However, `fGetAddr` currently does not work as originally intended and is no longer useful: - typically, the first ADDR we receive from a peer after sending the GETADDR is not the GETADDR response but the self-announcement of our peer. If this is the case, `fGetAddr` acts on it (preventing its relay) and is already inactivated once the GETADDR response is received. - 5cbf753 introduced the condition `vAddr.size() <= 10`, so messages with more than 10 elements won't be relayed further regardless. - since bitcoin#5419, we do not get more than one ADDR message in response to GETADDR because `vAddrToSend` cannot have more than 1000 elements. Removing the flag will cause initial self-announcements from outbound peers to be gossip-relayed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.