|
9 | 9 | #include <chainparams.h> |
10 | 10 | #include <common/bloom.h> |
11 | 11 | #include <compat.h> |
| 12 | +#include <node/connection_types.h> |
12 | 13 | #include <consensus/amount.h> |
13 | 14 | #include <crypto/siphash.h> |
14 | 15 | #include <hash.h> |
@@ -121,78 +122,6 @@ struct CSerializedNetMsg { |
121 | 122 | std::string m_type; |
122 | 123 | }; |
123 | 124 |
|
124 | | -/** Different types of connections to a peer. This enum encapsulates the |
125 | | - * information we have available at the time of opening or accepting the |
126 | | - * connection. Aside from INBOUND, all types are initiated by us. |
127 | | - * |
128 | | - * If adding or removing types, please update CONNECTION_TYPE_DOC in |
129 | | - * src/rpc/net.cpp and src/qt/rpcconsole.cpp, as well as the descriptions in |
130 | | - * src/qt/guiutil.cpp and src/bitcoin-cli.cpp::NetinfoRequestHandler. */ |
131 | | -enum class ConnectionType { |
132 | | - /** |
133 | | - * Inbound connections are those initiated by a peer. This is the only |
134 | | - * property we know at the time of connection, until P2P messages are |
135 | | - * exchanged. |
136 | | - */ |
137 | | - INBOUND, |
138 | | - |
139 | | - /** |
140 | | - * These are the default connections that we use to connect with the |
141 | | - * network. There is no restriction on what is relayed; by default we relay |
142 | | - * blocks, addresses & transactions. We automatically attempt to open |
143 | | - * MAX_OUTBOUND_FULL_RELAY_CONNECTIONS using addresses from our AddrMan. |
144 | | - */ |
145 | | - OUTBOUND_FULL_RELAY, |
146 | | - |
147 | | - |
148 | | - /** |
149 | | - * We open manual connections to addresses that users explicitly requested |
150 | | - * via the addnode RPC or the -addnode/-connect configuration options. Even if a |
151 | | - * manual connection is misbehaving, we do not automatically disconnect or |
152 | | - * add it to our discouragement filter. |
153 | | - */ |
154 | | - MANUAL, |
155 | | - |
156 | | - /** |
157 | | - * Feeler connections are short-lived connections made to check that a node |
158 | | - * is alive. They can be useful for: |
159 | | - * - test-before-evict: if one of the peers is considered for eviction from |
160 | | - * our AddrMan because another peer is mapped to the same slot in the tried table, |
161 | | - * evict only if this longer-known peer is offline. |
162 | | - * - move node addresses from New to Tried table, so that we have more |
163 | | - * connectable addresses in our AddrMan. |
164 | | - * Note that in the literature ("Eclipse Attacks on Bitcoin’s Peer-to-Peer Network") |
165 | | - * only the latter feature is referred to as "feeler connections", |
166 | | - * although in our codebase feeler connections encompass test-before-evict as well. |
167 | | - * We make these connections approximately every FEELER_INTERVAL: |
168 | | - * first we resolve previously found collisions if they exist (test-before-evict), |
169 | | - * otherwise we connect to a node from the new table. |
170 | | - */ |
171 | | - FEELER, |
172 | | - |
173 | | - /** |
174 | | - * We use block-relay-only connections to help prevent against partition |
175 | | - * attacks. By not relaying transactions or addresses, these connections |
176 | | - * are harder to detect by a third party, thus helping obfuscate the |
177 | | - * network topology. We automatically attempt to open |
178 | | - * MAX_BLOCK_RELAY_ONLY_ANCHORS using addresses from our anchors.dat. Then |
179 | | - * addresses from our AddrMan if MAX_BLOCK_RELAY_ONLY_CONNECTIONS |
180 | | - * isn't reached yet. |
181 | | - */ |
182 | | - BLOCK_RELAY, |
183 | | - |
184 | | - /** |
185 | | - * AddrFetch connections are short lived connections used to solicit |
186 | | - * addresses from peers. These are initiated to addresses submitted via the |
187 | | - * -seednode command line argument, or under certain conditions when the |
188 | | - * AddrMan is empty. |
189 | | - */ |
190 | | - ADDR_FETCH, |
191 | | -}; |
192 | | - |
193 | | -/** Convert ConnectionType enum to a string value */ |
194 | | -std::string ConnectionTypeAsString(ConnectionType conn_type); |
195 | | - |
196 | 125 | /** |
197 | 126 | * Look up IP addresses from all interfaces on the machine and add them to the |
198 | 127 | * list of local addresses to self-advertise. |
|
0 commit comments