Bitcoin Core automatically selects up to three BIP152 high-bandwidth peers after they deliver new blocks. This works well for ordinary connections, but it cannot use topology information known to the operator.
For example, an operator may run nodes in multiple locations, or maintain a stable, low-latency link to another node, and want that peer to announce compact blocks immediately and consistently, including after reconnects, instead of waiting for automatic selection.
This PR adds a bip152hb net permission:
-addnode=203.0.113.5 -whitelist=bip152hb,out@203.0.113.5
For a peer with this permission, the node requests high-bandwidth mode in the existing SENDCMPCT message sent at VERACK, so it applies to every connection to that peer and requires no new P2P messages. It works with the existing -whitelist/-whitebind semantics: out applies to manual connections (-addnode, -connect, addnode RPC), in (the default) to inbound connections, and subnets are supported. Matching is by IP address or subnet, so hostnames are not supported.
Peers with the permission are additional to the three automatically selected high-bandwidth peers and never take one of their slots. This intentionally allows explicit configuration to exceed BIP152's current three-peer recommendation and may increase redundant bandwidth. If accepted, BIP152 can be updated separately.
Notes:
bip152hbis not included inall: unlike the other flags it grants the peer nothing and only costs bandwidth, so existingall@configurations are unaffected.- The permission is rejected at startup with
-blocksonly, where high-bandwidth mode is never requested.
Earlier versions of this PR used an -addnode=<host>=bip152-hb suffix; it was reworked into a permission following review (https://github.com/bitcoin/bitcoin/pull/35940#issuecomment-6811490029).