Skip to content

feat(wire): rename ConnectionKind::Regular to OutboundFullRelay, add BlockRelayOnly and AddrFetch#970

Open
Sandipmandal25 wants to merge 1 commit into
getfloresta:masterfrom
Sandipmandal25:feat/connection-kind-variants
Open

feat(wire): rename ConnectionKind::Regular to OutboundFullRelay, add BlockRelayOnly and AddrFetch#970
Sandipmandal25 wants to merge 1 commit into
getfloresta:masterfrom
Sandipmandal25:feat/connection-kind-variants

Conversation

@Sandipmandal25
Copy link
Copy Markdown
Contributor

@Sandipmandal25 Sandipmandal25 commented Apr 19, 2026

Description and Notes

Renames ConnectionKind::Regular to OutboundFullRelay and adds BlockRelayOnly and AddrFetch variants to align with Bitcoin Cores connection_type strings in getpeerinfo.

Changes

  • Rename Regular(ServiceFlags) to OutboundFullRelay(ServiceFlags)

  • Add BlockRelayOnly(ServiceFlags) for block-relay-only anchor peers

  • Add AddrFetch for short-lived address discovery connections

  • Extra now serializes as "block-relay-only"

  • Add peer limits to NodeContext:

    • MAX_FULL_RELAY_PEERS

    • MAX_BLOCKS_ONLY_PEERS

    • MAX_MANUAL_PEERS

    • Update connection selection logic:

    • maybe_open_connection selects OutboundFullRelay or BlockRelayOnly based on available full relay slots

    • maybe_open_connection_with_added_peers applies MAX_MANUAL_PEERS based on connected peers

  • upgrade:

    • When an Extra peer delivers new headers, it is promoted to OutboundFullRelay or BlockRelayOnly depending on available slots
    • If needed, the lowest-scoring peer of that type is replaced
    • If no peer of that type exists, promotion happens in place
  • Replace .unwrap() with ? in check_for_stale_tip

  • Add WireError::OutboundPeersExceeded

Result

The connection_type field in getpeerinfo rpc responses right now matches Bitcoin Core values:

  • outbound full relay
  • block relay only
  • manual
  • feeler
  • addrfetch

Closes #623

image

@Sandipmandal25 Sandipmandal25 marked this pull request as draft April 19, 2026 22:30
@Sandipmandal25 Sandipmandal25 marked this pull request as ready for review April 20, 2026 15:59
@Sandipmandal25
Copy link
Copy Markdown
Contributor Author

Friendly ping @Davidson-Souza @jaoleal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve ConnectionKind enums;

1 participant