This is the documented max size for an addr response, and was separately being limited in PushAddress to 1000 via MAX_ADDR_TO_SEND. No point in selecting a too-large random set then filtering it randomly down to a smaller set.
p2p: Return a max of 1000 addrs from CAddrMan::GetAddr #14154
pull Empact wants to merge 2 commits into bitcoin:master from Empact:getaddr-max changing 5 files +15 −15-
Empact commented at 7:03 PM on September 5, 2018: member
-
e6d375b1c0
p2p: Return a max of 1000 addrs from CAddrMan::GetAddr
This is the documented max size for an addr response, and was separately being limited in PushAddress to 1000 via MAX_ADDR_TO_SEND. No point in selecting a too-large random set then filtering it randomly down to a smaller set.
-
MarcoFalke commented at 7:13 PM on September 5, 2018: member
I think addrman would return a larger list that is node-agnostic and then net would filter that list taking into account the node state, no?
-
in src/addrman.h:175 in e6d375b1c0 outdated
171 | @@ -172,7 +172,7 @@ class CAddrInfo : public CAddress 172 | #define ADDRMAN_GETADDR_MAX_PCT 23 173 | 174 | //! the maximum number of nodes to return in a getaddr call 175 | -#define ADDRMAN_GETADDR_MAX 2500 176 | +#define ADDRMAN_GETADDR_MAX 1000
practicalswift commented at 7:50 PM on September 5, 2018:When we're editing this file – what about skipping the use of the preprocessor and use proper constants instead? :-)
DrahtBot commented at 8:09 PM on September 5, 2018: member<!--e57a25ab6845829454e8d69fc972939a-->Note to reviewers: This pull request conflicts with the following ones:
- #14033 (p2p: Drop CADDR_TIME_VERSION checks now that MIN_PEER_PROTO_VERSION is greater by Empact)
- #13115 (addrman: Add Clang thread safety annotations for variables guarded by cs_addrMan by practicalswift)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Empact commented at 8:20 PM on September 5, 2018: member@MarcoFalke the only call to
GetAddr/GetAddr_is in service of thisGETADDRresponse: https://github.com/bitcoin/bitcoin/blob/95d731d9b38819cb822dbcd365972a14ae78d21f/src/net_processing.cpp#L2747-L2750PushAddressjust overwrites entry if it's beyond the limit: https://github.com/bitcoin/bitcoin/blob/95d731d9b38819cb822dbcd365972a14ae78d21f/src/net.h#L816-L828fanquake added the label P2P on Sep 5, 2018gmaxwell commented at 7:06 PM on September 6, 2018: contributorI thought the two layer setup was so that multiple probes would get more addresses but not enumerate the whole table.
in src/net_processing.cpp:1760 in e6d375b1c0 outdated
1756 | @@ -1757,7 +1757,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr 1757 | } 1758 | 1759 | // Get recent addresses 1760 | - if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || connman->GetAddressCount() < 1000) 1761 | + if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || connman->GetAddressCount() < ADDRMAN_GETADDR_MAX)
laanwj commented at 6:32 AM on September 11, 2018:I like changing these to a constant, however "maximum number of addresses in GETADDR" is a P2P layer constant, I don't think it should use addrman's internal constant.
src/protocol.hwould be a better place.MarcoFalke commented at 1:36 PM on September 11, 2018: member@Empact
PushAddrwill return early whenaddrKnown.containsit. So whenvAddris of size 1000, it might very well send less than 1000 addresses back in the response, even though there are plenty to send. No?Empact commented at 12:38 AM on September 12, 2018: member@MarcoFalke yep that sounds like the explanation. Thanks!
Empact closed this on Sep 12, 2018Empact reopened this on Sep 12, 201868a8acca8eDon't return known addresses from CConnman::GetAddresses
These addresses are used expressly for sending to a node in response to GETADDR, so we may as well skip them over in the lookup soas to return the appropriate number.
Empact force-pushed on Sep 16, 2018Empact closed this on Sep 16, 2018MarcoFalke locked this on Sep 8, 2021Labels
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-30 00:15 UTC
More mirrored repositories can be found on mirror.b10c.me