p2p: Don't require services from `ADDR_FETCH` peers #26343

pull mzumsande wants to merge 1 commits into bitcoin:master from mzumsande:202210_addrfetch_servicebits changing 1 files +1 −1
  1. mzumsande commented at 7:35 PM on October 19, 2022: contributor

    While testing #20018, I noticed that we sometimes make an AddrFetch connection to a node a DNS seed resolves to (if we have a -proxy set), but then disconnect them because we don't like their services. The same could happen for a manually added -seednode. However, we only want addresses from these peers, which are not related to any of the current service flags, so I don't see a point in aborting an AddrFetch attempt due to undesirable services.

  2. p2p: Don't require services from AddrFetch peers
    We only want a GETADDR response from them, which is
    not related to any of the current service flags, so
    there is no point in disconnecting them for undesirable
    services.
    b39f471f8f
  3. DrahtBot added the label P2P on Oct 19, 2022
  4. DrahtBot commented at 9:50 PM on October 19, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  5. dergoegge commented at 12:11 PM on October 20, 2022: member

    However, we only want addresses from these peers, which are not related to any of the current service flags, so I don't see a point in aborting an AddrFetch attempt due to undesirable services.

    MayHaveUsefulAddressDB makes me think we that we are assuming nodes signaling NODE_NETWORK or NODE_NETWORK_LIMITED to have a useful addr db.

    https://github.com/bitcoin/bitcoin/blob/2ac71d20b2ebbfea76ee7369fddffbd78bd2c010/src/protocol.h#L352-L359

  6. mzumsande commented at 6:34 PM on October 20, 2022: contributor

    MayHaveUsefulAddressDB makes me think we that we are assuming nodes signaling NODE_NETWORK or NODE_NETWORK_LIMITED to have a useful addr db.

    Interesting! I guess we could leave ExpectServicesFromConn as is but check for MayHaveUsefulAddressDB() instead of HasAllDesirableServiceFlags() for an AddrFetch connections when deciding whether to accept the peer.

    However, I'm not sure this would be ideal, for the following reasons:

    • MayHaveUsefulAddressDB is used to decide whether we want to connect to a feeler, and whether to process a received addr at all. In neither of these situations we particularly care about the peer's address db (we don't even request addrs from feelers), we care whether it is a (pruned or not) full node, so the function might better be named IsFullNode().
    • MayHaveUsefulAddressDB just makes the assumption that SPV clients don't know about address relay when they can't serve blocks - that may be the case for most current software, but I don't see why a SPV node shouldn't implement addr relay.
    • When we do an AddrFetch connection, we usually don't have a bunch of alternative addrs (otherwise there would be no need to make such a connection in the first place) - we either manually specified this peer (-seednode), it's a peer a DNS seed resolves to, or (if #26114 makes it in) it's a fixed seed. When we do make an AddrFetch connection and the peer doesn't deliver addrs, we disconnect them after a few minutes. So I can't see the hurt in trying, even if the service bits don't match, if we don't have a better alternative.
  7. mzumsande commented at 8:04 PM on April 3, 2023: contributor

    closing, there doesn't seem to be much interest and even though I still think it could make sense, it's certainly not critical.

  8. mzumsande closed this on Apr 3, 2023

  9. bitcoin locked this on Apr 2, 2024

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-17 03:13 UTC

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