Skip to content

Commit 2863d7d

Browse files
committed
net: store -whitelist{force}relay values in CConnman
1 parent 801ef07 commit 2863d7d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/init.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
17751775
connOptions.m_added_nodes = args.GetArgs("-addnode");
17761776
connOptions.nMaxOutboundLimit = *opt_max_upload;
17771777
connOptions.m_peer_connect_timeout = peer_connect_timeout;
1778+
connOptions.whitelist_forcerelay = args.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY);
1779+
connOptions.whitelist_relay = args.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY);
17781780

17791781
// Port to bind to if `-bind=addr` is provided without a `:port` suffix.
17801782
const uint16_t default_bind_port =

src/net.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,8 @@ class CConnman
10641064
std::vector<std::string> m_specified_outgoing;
10651065
std::vector<std::string> m_added_nodes;
10661066
bool m_i2p_accept_incoming;
1067+
bool whitelist_forcerelay = DEFAULT_WHITELISTFORCERELAY;
1068+
bool whitelist_relay = DEFAULT_WHITELISTRELAY;
10671069
};
10681070

10691071
void Init(const Options& connOptions) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex, !m_total_bytes_sent_mutex)
@@ -1098,6 +1100,8 @@ class CConnman
10981100
}
10991101
}
11001102
m_onion_binds = connOptions.onion_binds;
1103+
whitelist_forcerelay = connOptions.whitelist_forcerelay;
1104+
whitelist_relay = connOptions.whitelist_relay;
11011105
}
11021106

11031107
CConnman(uint64_t seed0, uint64_t seed1, AddrMan& addrman, const NetGroupManager& netgroupman,
@@ -1551,6 +1555,18 @@ class CConnman
15511555
*/
15521556
std::vector<CService> m_onion_binds;
15531557

1558+
/**
1559+
* flag for adding 'forcerelay' permission to whitelisted inbound
1560+
* and manual peers with default permissions.
1561+
*/
1562+
bool whitelist_forcerelay;
1563+
1564+
/**
1565+
* flag for adding 'relay' permission to whitelisted inbound
1566+
* and manual peers with default permissions.
1567+
*/
1568+
bool whitelist_relay;
1569+
15541570
/**
15551571
* Mutex protecting m_i2p_sam_sessions.
15561572
*/

0 commit comments

Comments
 (0)