/tmp/bitcoin/src/node/connection_types.cpp
Line | Count | Source |
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 | | |
5 | | #include <node/connection_types.h> |
6 | | #include <cassert> |
7 | | |
8 | | std::string ConnectionTypeAsString(ConnectionType conn_type) |
9 | 15.8k | { |
10 | 15.8k | switch (conn_type) { |
11 | 9.24k | case ConnectionType::INBOUND: |
12 | 9.24k | return "inbound"; |
13 | 5.47k | case ConnectionType::MANUAL: |
14 | 5.47k | return "manual"; |
15 | 4 | case ConnectionType::FEELER: |
16 | 4 | return "feeler"; |
17 | 971 | case ConnectionType::OUTBOUND_FULL_RELAY: |
18 | 971 | return "outbound-full-relay"; |
19 | 106 | case ConnectionType::BLOCK_RELAY: |
20 | 106 | return "block-relay-only"; |
21 | 29 | case ConnectionType::ADDR_FETCH: |
22 | 29 | return "addr-fetch"; |
23 | 26 | case ConnectionType::PRIVATE_BROADCAST: |
24 | 26 | return "private-broadcast"; |
25 | 15.8k | } // no default case, so the compiler can warn about missing cases |
26 | | |
27 | 15.8k | assert(false); |
28 | 0 | } |
29 | | |
30 | | std::string TransportTypeAsString(TransportProtocolType transport_type) |
31 | 15.2k | { |
32 | 15.2k | switch (transport_type) { |
33 | 69 | case TransportProtocolType::DETECTING: |
34 | 69 | return "detecting"; |
35 | 13.0k | case TransportProtocolType::V1: |
36 | 13.0k | return "v1"; |
37 | 2.08k | case TransportProtocolType::V2: |
38 | 2.08k | return "v2"; |
39 | 15.2k | } // no default case, so the compiler can warn about missing cases |
40 | | |
41 | 15.2k | assert(false); |
42 | 0 | } |