2026 10 dont evict on frequent reconnect #36561

pull 0xB10C wants to merge 5 commits into bitcoin:master from 0xB10C:2026-10-dont-evcit-on-frequent-reconnect changing 12 files +368 −12
  1. 0xB10C commented at 1:07 AM on October 18, 2026: contributor

    No description provided.

  2. net: remember addresses of recent inbound connection attempts
    Add two rolling bloom filters to CConnman that record which addresses
    (IPv6: which /48s) made inbound connection attempts in the current and
    the previous INBOUND_RECONNECT_WINDOW (10 minutes). The filters are
    swapped once a window has passed, so an address is remembered for
    between one and two windows after its last attempt and then forgotten.
    If more than two windows pass without any attempt, both filters are
    cleared.
    
    NoteInboundAttempt() records an attempt and reports whether the same
    key made at least two attempts within that time. The threshold is two
    rather than one so that a single honest retry is never counted: a peer
    whose first connection was closed before it received anything retries
    once with v1 (V2Transport::ShouldReconnectV1), and a node that restarts
    reconnects once. An address that connects three times in twenty
    minutes is not doing either. It is not used yet.
    
    IPv6 is keyed by /48 because the entity this targets controls a whole
    /48 and could otherwise use a fresh address per attempt. Honest nodes
    sharing a /48 are lumped together; in practice that is rare (a day of
    inbound traffic on a busy node showed 60 distinct /48s carrying 64
    distinct /64s) and it only matters while the node is full.
    
    Since the filters can't count, each key uses two entries: key+1 after
    the first attempt and key+2 after the second. Entries are only inserted
    when not already present: every insert counts towards the filter's own
    generation rollover, and an address that retries every second must not
    push the others out.
    1cb8fa55e1
  3. net: drop recent reconnects instead of evicting when inbound slots are full
    When an inbound connection arrives from an address that already made
    two attempts within the last one to two INBOUND_RECONNECT_WINDOWs and
    all inbound slots are taken, drop the new connection instead of
    evicting an existing peer for it. If a slot is free the connection is
    accepted as before, so this is not a ban: it only decides who gives
    way when we are full.
    
    This targets entities that open many short-lived inbound connections
    and reconnect within a second of being disconnected. On a full node
    every such attempt evicted an existing peer, which is almost always
    the youngest one, i.e. an honest peer that connected a moment ago.
    
    Inbound Tor connections (which all come from the local Tor proxy),
    local addresses in general and NoBan peers are not tracked. The
    test-only option -test=inbound_reconnect_check_local applies the check
    to local addresses so that the functional tests, which connect from
    127.0.0.1, can exercise it.
    
    The result is stored in CNode::m_recent_reconnect for use by the
    tx-relay capacity check in net_processing.
    d4cc7e4b5f
  4. p2p: drop recent reconnects instead of evicting when tx-relay slots are full
    With -inboundrelaypercent, a new inbound peer that relays transactions
    can evict an existing tx-relaying inbound peer when it sends its
    version message (or later, when it switches to tx relay with
    filterload/filterclear). On nodes with default settings the tx-relay
    slots fill long before the overall inbound limit, so this is where
    reconnecting entities evict the most peers.
    
    Apply the same rule as in CreateNodeFromAcceptedSocket: if the address
    of the new peer connected recently, drop the new peer when the
    tx-relay slots are full, instead of evicting an existing one.
    
    Split CConnman::EvictTxPeerIfFull() into InboundTxRelayFull() and the
    eviction attempt so that the capacity check can be used on its own.
    9f6a312d1a
  5. test: add p2p_inbound_reconnect.py
    Cover both paths of the reconnect check with -maxconnections=13 (two
    inbound slots, one of them for tx relay): a reconnecting address is
    accepted while a slot is free, dropped at accept time when the inbound
    slots are full, dropped after version (and after filterload) when the
    tx-relay slot is taken, forgotten after two windows, and treated as
    before without the test-only option that includes local addresses in
    the check.
    
    With two inbound slots nothing is ever evictable, so p2p_eviction.py is
    extended to run its 21-peer setup a second time with the check applied
    to local addresses: the peer that triggered an eviction before is now
    dropped instead, and all other peers stay connected.
    2b5ac51c66
  6. doc: add release note for the inbound reconnect check e618b395fa
  7. DrahtBot commented at 1:07 AM on October 18, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  8. 0xB10C closed this on Oct 18, 2026

  9. 0xB10C commented at 1:20 AM on October 18, 2026: contributor

    wasn't intended for this repo yet.. I was sure I selected mine

Contributors

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-10-30 09:40 UTC