See #5917
Unified number constants of getaddr return addrs #5919
pull tnull wants to merge 1 commits into bitcoin:master from tnull:master changing 4 files +6 −8-
tnull commented at 3:01 PM on March 17, 2015: none
-
jonasschnelli commented at 7:18 PM on March 17, 2015: contributor
@tnull: i think it would be good to give a more detailed commit message.
-
laanwj commented at 9:04 AM on March 18, 2015: member
ACK on replacing 1000 with a constant where appropriate.
NACK on the naming.
MAX_ADDR_TO_SENDin net.h is clear, usingADDRMAN_GETADDR_MAXeverywhere less so.As for unifying them, I tend to say no unless there is a clear problem. Remember that there are various filtering steps that reduce the size of the list, for example to remove addresses already known, so starting off with 1000 entries may result in much less than 1000 being returned.
- laanwj added the label P2P on Mar 18, 2015
-
ae599054ee
Unified number constants of getaddr return addrs
- Reduced ADDRMAN_GETADDR_MAX to 1000 (was 2500, but the addr vector would later be reduced to 1000 addrs anyhow). - Removed MAX_ADDR_TO_SEND and replaced it with ADDRMAN_GETADDR_MAX. - Introduced the constant where before "1000" was hardcoded
-
tnull commented at 11:16 AM on March 18, 2015: none
@jonasschnelli Amended the commit to have a better message. @laanwj Thats true,
MAX_ADDR_TO_SENDis better, however, I didn't want to introduce circular dependencies, or modify many files for this first minimal patch, before I didn't hear from the developers.MAX_ADDR_TO_SENDcan't be used in addrman.h/.cpp, whileADDRMAN_GETADDR_MAXis available in net.h, if we include addrman.h in it (instead of net.cpp). On less than 1000 addresses being returned: the same can be true for 2500...Additionally, there is an other problem in the filtering I discovered: When nodes announce their
addrfor the first time, don't get elected trickle node, and then want to answer agetaddr-message, couldn't it happen, that their queuedaddr-message gets overwritten and therefore never gets flooded? - tnull renamed this:
Replaced MAX_ADDR_TO_SEND with ADDRMAN_GETADDR_MAX
Unified number constants of getaddr return addrs
on Mar 18, 2015 -
laanwj commented at 12:09 PM on March 18, 2015: member
On less than 1000 addresses being returned: the same can be true for 2500...
But with a smaller probability.
-
sipa commented at 12:43 PM on March 18, 2015: member
Also, the 1000 number is part of the protocol implementation, the 2500 is from addrman. I don't think that changing a number in addrman should have an effect on protocol behaviour, so it seems weird to use addrman's constant inside net.
-
tnull commented at 12:43 PM on March 18, 2015: none
But with a smaller probability.
Of course! I argue that the concept of checking and reducing the set of addrs multiple times is flawed and since it's creating a new vector every time should introduce a good amount of overhead. But probably you're right, if the concept stays the same, it'll be better to leave it at 2500.
-
laanwj commented at 12:48 PM on March 18, 2015: member
Well, the concept is not changing here, just the number, so I'm commenting on that :)
Have you measured the overhead? Without measurements from a profiler that show that this is actually a big time sink for a node, I wouldn't worry about it.
-
tnull commented at 12:48 PM on March 18, 2015: none
I don't think that changing a number in addrman should have an effect on protocol behaviour, so it seems weird to use addrman's constant inside net.
True again. Maybe this request can be closed, maybe I'll send another one just replacing some of the hardcoded "1000" number with
MAX_ADDR_TO_SENDconstant.Does anyone have thoughts on the issue of the possibility that initial
addr-messages get overwritten in the queue byPushAddress()and therefore never get sent? -
laanwj commented at 11:27 AM on March 19, 2015: member
You mean that the node's self-advertisement may get lost? I don't think that is a huge issue. It will re-advertise and for some peer, at some point it's bound to get through. Some unpredictability in getaddr may even be desirable to break assumptions about the returned data.
-
tnull commented at 10:28 AM on March 20, 2015: none
Ok, I understand if you think this is no huge issue. However, I fail to see how this unpredictability would be desirable (on top of randomizing returned addresses). Closing this request now, thanks for your time! :)
- tnull closed this on Mar 20, 2015
- DrahtBot locked this on Sep 8, 2021