I think for “heavy objects” (non integral), we use extern const
in the header and put them in the c++ file. This might reduce the size of the binary minimally.
So if you need to touch this code in the future again, you could apply the following diff (or similar):
0diff --git a/src/net.cpp b/src/net.cpp
1index 5b533d7d17..166fc8233d 100644
2--- a/src/net.cpp
3+++ b/src/net.cpp
4@@ -488,6 +488,15 @@ void CConnman::AddWhitelistPermissionFlags(NetPermissionFlags& flags, const CNet
5 }
6 }
7
8+extern const std::vector<std::string> CONNECTION_TYPE_DOC{
9+ "outbound-full-relay (default automatic connections)",
10+ "block-relay-only (does not relay transactions or addresses)",
11+ "inbound (initiated by the peer)",
12+ "manual (added via addnode RPC or -addnode/-connect configuration options)",
13+ "addr-fetch (short-lived automatic connection for soliciting addresses)",
14+ "feeler (short-lived automatic connection for testing addresses)",
15+};
16+
17 std::string CNode::ConnectionTypeAsString() const
18 {
19 switch (m_conn_type) {
20diff --git a/src/net.h b/src/net.h
21index 5a8e57b68b..3c6c45c161 100644
22--- a/src/net.h
23+++ b/src/net.h
24@@ -114,13 +114,7 @@ struct CSerializedNetMsg
25 std::string m_type;
26 };
27
28-const std::vector<std::string> CONNECTION_TYPE_DOC{
29- "outbound-full-relay (default automatic connections)",
30- "block-relay-only (does not relay transactions or addresses)",
31- "inbound (initiated by the peer)",
32- "manual (added via addnode RPC or -addnode/-connect configuration options)",
33- "addr-fetch (short-lived automatic connection for soliciting addresses)",
34- "feeler (short-lived automatic connection for testing addresses)"};
35+extern const std::vector<std::string> CONNECTION_TYPE_DOC;
36
37 /** Different types of connections to a peer. This enum encapsulates the
38 * information we have available at the time of opening or accepting the