Bitcoin Core  31.0.0
P2P Digital Currency
connection_types.cpp
Go to the documentation of this file.
1 // Copyright (c) 2022-present The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
6 #include <cassert>
7 
8 std::string ConnectionTypeAsString(ConnectionType conn_type)
9 {
10  switch (conn_type) {
12  return "inbound";
14  return "manual";
16  return "feeler";
18  return "outbound-full-relay";
20  return "block-relay-only";
22  return "addr-fetch";
24  return "private-broadcast";
25  } // no default case, so the compiler can warn about missing cases
26 
27  assert(false);
28 }
29 
30 std::string TransportTypeAsString(TransportProtocolType transport_type)
31 {
32  switch (transport_type) {
34  return "detecting";
36  return "v1";
38  return "v2";
39  } // no default case, so the compiler can warn about missing cases
40 
41  assert(false);
42 }
BIP324 protocol.
AddrFetch connections are short lived connections used to solicit addresses from peers.
Inbound connections are those initiated by a peer.
assert(!tx.IsCoinBase())
Unencrypted, plaintext protocol.
Feeler connections are short-lived connections made to check that a node is alive.
TransportProtocolType
Transport layer version.
These are the default connections that we use to connect with the network.
std::string TransportTypeAsString(TransportProtocolType transport_type)
Convert TransportProtocolType enum to a string value.
We open manual connections to addresses that users explicitly requested via the addnode RPC or the -a...
std::string ConnectionTypeAsString(ConnectionType conn_type)
Convert ConnectionType enum to a string value.
Peer could be v1 or v2.
ConnectionType
Different types of connections to a peer.
Private broadcast connections are short-lived and only opened to privacy networks (Tor...
We use block-relay-only connections to help prevent against partition attacks.