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
  1. tnull commented at 3:01 PM on March 17, 2015: none

    See #5917

  2. 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.

  3. 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_SEND in net.h is clear, using ADDRMAN_GETADDR_MAX everywhere 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.

  4. laanwj added the label P2P on Mar 18, 2015
  5. 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
    ae599054ee
  6. 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_SEND is 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_SEND can't be used in addrman.h/.cpp, while ADDRMAN_GETADDR_MAX is 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 addr for the first time, don't get elected trickle node, and then want to answer a getaddr-message, couldn't it happen, that their queued addr-message gets overwritten and therefore never gets flooded?

  7. tnull renamed this:
    Replaced MAX_ADDR_TO_SEND with ADDRMAN_GETADDR_MAX
    Unified number constants of getaddr return addrs
    on Mar 18, 2015
  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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_SEND constant.

    Does anyone have thoughts on the issue of the possibility that initial addr-messages get overwritten in the queue by PushAddress() and therefore never get sent?

  13. 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.

  14. 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! :)

  15. tnull closed this on Mar 20, 2015

  16. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

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-29 03:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me