Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
jeanpablojp
left a comment
There was a problem hiding this comment.
Concept ACK
The opt-in override of the BIP152 three-peer cap seems fine to me, since it's an explicit operator choice, not a default, and it's disclosed upfront.
Reusing -addnode also made more sense to me than creating a dedicated option.
8ebd31e to
3072e06
Compare
Bicaru20
left a comment
There was a problem hiding this comment.
Concept ACK
I think it’s a good addition to let users add their own high-bandwidth peers, as it gives them more control. I was initially worried about there being no cap on the number of user-selected high-bandwidth peers. However, since this will mostly be used by advanced users, it only affects the operator's own node, and the release notes already warn about the extra bandwidth, I think it's okay to leave it as is.
| extra_args=["-blocksonly", "-addnode=127.0.0.1:18444=bip152-hb"], | ||
| expected_msg="Error: Invalid -addnode value '127.0.0.1:18444=bip152-hb': the bip152-hb suffix is incompatible with -blocksonly", | ||
| ) | ||
|
|
There was a problem hiding this comment.
Following the same pattern as in the test_empty_addnode in line 268 of the same file, I think we could also check the case where an -addnodeis empty but carries the suffixbip152-hb (-addnode==bip152-hb`).
| with node.assert_debug_log(expected_msgs=["Ignoring empty -addnode value"]): | |
| self.start_node(0, extra_args=["-blocksonly", "-addnode==bip152-hb"]) | |
| util.assert_equal(node.getaddednodeinfo(), []) |
| # Receiving another block from the configured peer must not insert it | ||
| # into the automatic list or displace one of those three peers. | ||
| assert_equal(self.relay_block_through(2), [True, True, True, True]) | ||
|
|
There was a problem hiding this comment.
We could add the test case where a configured peer disconnects and reconnects again on its own is granted the high-bandwidth mode again.
| self.restart_node(2) | |
| self.wait_until(configured_peer_connected) | |
| assert_equal(self.relay_block_through(3), [True, True, True, True]) |
There was a problem hiding this comment.
Thanks, good idea! Added in 0b54bdb, with a small change: rather than restarting node 2, the test disconnects it and reconnects with addnode ... onetry. Otherwise the addnode thread can take up to 60s to retry.
3072e06 to
499495a
Compare
|
Concept ACK, but I think it might make more sense to do this as a whitelist permission. |
| - Added persistent BIP152 high-bandwidth compact block announcement requests | ||
| for selected outbound added-node connections. Append `=bip152-hb` to an | ||
| `-addnode=<host>[:<port>]` value to request high-bandwidth announcements from | ||
| connections opened for that added node. |
There was a problem hiding this comment.
| connections opened for that added node. | |
| connections opened for that added node. (#35940) |
499495a to
5bf17f2
Compare
Add a "bip152hb" permission that can be granted with -whitelist and -whitebind, and that is reported by getpeerinfo. The next commit uses it to request BIP152 high-bandwidth compact block announcements from such peers, so operators can apply topology knowledge (for example a low-latency link to another node they run) that the automatic high-bandwidth peer selection cannot have. Unlike the existing flags, this one grants the peer nothing and only makes us request extra announcements. It is therefore not part of "all", which would otherwise increase bandwidth usage for existing configurations. The flag has no effect yet.
5bf17f2 to
7549b41
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
Bitcoin Core automatically selects up to three BIP152 high-bandwidth peers after they deliver new blocks. That selection cannot use topology information known to the operator, e.g. a stable low-latency link to another node they run, which should announce compact blocks immediately and consistently, including after reconnects. For peers with the bip152hb permission, request high-bandwidth mode in the SENDCMPCT message sent at VERACK, so that this applies to every connection to such a peer. Keep these peers out of lNodesAnnouncingHeaderAndIDs: they are additional to the three automatically selected peers and must not displace them. As for the automatic selection, never request high-bandwidth mode in -blocksonly mode. Combined with the existing "out" whitelist direction, this lets an operator configure an added node as high-bandwidth, e.g. -addnode=203.0.113.5 -whitelist=bip152hb,[email protected] The cmpctblock fuzz target asserted that there are at most three high-bandwidth peers. Only count automatically selected ones there, and check that peers with the permission are high-bandwidth once the handshake completes.
High-bandwidth compact block announcements are never requested in -blocksonly mode, because our mempool would not contain the transactions needed to reconstruct the blocks. Fail at startup when -whitelist or -whitebind grants the bip152hb permission in that mode, rather than silently ignoring the operator's configuration.
7549b41 to
c29c91f
Compare
|
Thanks @davidgumberg for the suggestion! I've reworked the PR to add a The diff is a lot smaller now: there's no extra As a bonus, it now also works with the Two trade-offs:
I think losing hostnames is acceptable so I pushed a new version. |
|
PR description updated. |
-addnode
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
bip152hbnet permission:For a peer with this permission, the node requests high-bandwidth mode in the existing
SENDCMPCTmessage sent atVERACK, so it applies to every connection to that peer and requires no new P2P messages. It works with the existing-whitelist/-whitebindsemantics:outapplies to manual connections (-addnode,-connect,addnodeRPC),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.-blocksonly, where high-bandwidth mode is never requested.Earlier versions of this PR used an
-addnode=<host>=bip152-hbsuffix; it was reworked into a permission following review (#35940 (comment)).