mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge #19316: [net] Cleanup logic around connection types
01e283068b[net] Remove unnecessary default args on CNode constructor (Amiti Uttarwar)bc5d65b3ca[refactor] Remove IsOutboundDisconnectionCandidate (Amiti Uttarwar)2f2e13b6c2[net/refactor] Simplify multiple-connection checks (Amiti Uttarwar)7f7b83deb2[net/refactor] Rework ThreadOpenConnections logic (Amiti Uttarwar)35839e963b[net] Fix bug where AddrFetch connections would be counted as outbound full relay (Amiti Uttarwar)4972c21b67[net/refactor] Clarify logic for selecting connections in ThreadOpenConnections (Amiti Uttarwar)60156f5fc4[net/refactor] Remove fInbound flag from CNode (Amiti Uttarwar)7b322df629[net/refactor] Remove m_addr_fetch member var from CNode (Amiti Uttarwar)14923422b0[net/refactor] Remove fFeeler flag from CNode (Amiti Uttarwar)49efac5cae[net/refactor] Remove m_manual_connection flag from CNode (Amiti Uttarwar)d3698b5ee3[net/refactor] Add connection type as a member var to CNode (Amiti Uttarwar)46578c03e9[doc] Describe different connection types (Amiti Uttarwar)442abae2ba[net/refactor] Add AddrFetch connections to ConnectionType enum (Amiti Uttarwar)af59feb052[net/refactor] Extract m_addr_known logic from initializer list (Amiti Uttarwar)e1bc29812d[net/refactor] Add block relay only connections to ConnectionType enum (Amiti Uttarwar)0e52a659a2[net/refactor] Add feeler connections to ConnectionType enum (Amiti Uttarwar)1521c47438[net/refactor] Add manual connections to ConnectionType enum (Amiti Uttarwar)26304b4100[net/refactor] Introduce an enum to distinguish type of connection (Amiti Uttarwar)3f1b7140e9scripted-diff: Rename OneShot to AddrFetch (Amiti Uttarwar) Pull request description: **This is part 1 of #19315, which enables the ability to test `outbound` and `block-relay-only` connections from the functional tests.** Please see that PR for more information of overall functionality. **This PR simplifies how we manage different connection types.** It introduces an enum with the various types of connections so we can explicitly define the connection type. The existing system relies on a series of independent flags, then has asserts scattered around to ensure that conflicting flags are not enabled at the same time. I find this approach to be both brittle and confusing. While making these changes, I found a small bug due to the silent assumptions. This PR also proposes a rename from `OneShot` to `AddrFetch`. I find the name `OneShot` to be very confusing, especially when we also have `onetry` manual connections. Everyone I've talked to offline has agreed that the name is confusing, so I propose a potential alternative. I think this is a good opportunity for a rename since I'm creating an enum to explicitly define the connection types. (some context for the unfamiliar: `oneshot` or `addrfetch` connections are short-lived connections created on startup. They connect to the seed peers, send a `getaddr` to solicit addresses, then close the connection.) Overview of this PR: * rename `oneshot` to `addrfetch` * introduce `ConnectionType` enum * one by one, add different connection types to the enum * expose the `conn_type` on CNode, and use this to reduce reliance on flags (& asserts) * fix the bug in counting different type of connections * some additional cleanup to simplify logic and make expectations explicit/inclusive rather than implicit/exclusive. ACKs for top commit: jnewbery: utACK01e283068blaanwj: Code review ACK01e283068b, the commits are pretty straightforward to follow, and I think this is a move in the right direction overall vasild: ACK01e283068sdaftuar: ACK01e283068b. fanquake: ACK01e283068b- I don't have as much experience with the networking code but these changes look fairly straight forward, the new code seems more robust/understandable and the additional documentation is great. I'm glad that a followup branch is already underway. There might be some more review comments here later today, so keep an eye on the discussion, however I'm going to merge this now. jb55: wow this code was messy before... ACK01e283068bTree-SHA512: 7bb644a6ed5849913d777ebc2ff89133ca0fbef680355a9a344e07496a979e6f9ff21a958e8eea93dcd7d5c343682b0c7174b1a3de380a4247eaae73da436e15
This commit is contained in:
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
// Note that of those which support the service bits prefix, most only support a subset of
|
||||
// possible options.
|
||||
// This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
|
||||
// This is fine at runtime as we'll fall back to using them as an addrfetch if they don't support the
|
||||
// service bits we want, but we should get them updated to support all service bits wanted by any
|
||||
// release ASAP to avoid it where possible.
|
||||
vSeeds.emplace_back("seed.bitcoin.sipa.be"); // Pieter Wuille, only supports x1, x5, x9, and xd
|
||||
|
||||
Reference in New Issue
Block a user