v29.4-roots.3 · Commit 3: [PATCH 03/30] policy: restore conservative relay and network controls
src/net_permissions.cpp
Before: src/net_permissions.cpp · After: src/net_permissions.cpp
File metadata
index 8f0042c141f6cefba004e1285b787f33c6ca4983..458f82ac4c3a0d930f49cfdb552dada9e2a7b110 100644
Download original patch · Release notes
Diff rows 1–36 of 36. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/net_permissions.cpp
CHANGED
|
@@ -12,12 +12,14 @@ using common::ResolveErrMsg;
|
|
|
12
12
|
|
|
13
13
|
const std::vector<std::string> NET_PERMISSIONS_DOC{
|
|
14
14
|
"bloomfilter (allow requesting BIP37 filtered blocks and transactions)",
|
|
15
|
+
"blockfilters (serve compact block filters to peers per BIP157)",
|
|
15
16
|
"noban (do not ban for misbehavior; implies download)",
|
|
16
17
|
"forcerelay (relay transactions that are already in the mempool; implies relay)",
|
|
17
18
|
"relay (relay even in -blocksonly mode, and unlimited transaction announcements)",
|
|
18
19
|
"mempool (allow requesting BIP35 mempool contents)",
|
|
19
20
|
"download (allow getheaders during IBD, no disconnect after maxuploadtarget limit)",
|
|
20
|
-
"addr (responses to GETADDR avoid hitting the cache and contain random records with the most up-to-date info)"
|
|
21
|
+
"addr (responses to GETADDR avoid hitting the cache and contain random records with the most up-to-date info)",
|
|
22
|
+
"forceinbound (when connections are full, attempt to evict a random unprotected inbound peer to open a slot; implies noban)"
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
namespace {
|
|
@@ -48,6 +50,7 @@ static bool TryParsePermissionFlags(const std::string& str, NetPermissionFlags&
|
|
|
48
50
|
if (commaSeparator != std::string::npos) readen++; // We read ","
|
|
49
51
|
|
|
50
52
|
if (permission == "bloomfilter" || permission == "bloom") NetPermissions::AddFlag(flags, NetPermissionFlags::BloomFilter);
|
|
53
|
+
else if (permission == "blockfilters" || permission == "compactfilters" || permission == "cfilters") NetPermissions::AddFlag(flags, NetPermissionFlags::BlockFilters_Explicit);
|
|
51
54
|
else if (permission == "noban") NetPermissions::AddFlag(flags, NetPermissionFlags::NoBan);
|
|
52
55
|
else if (permission == "forcerelay") NetPermissions::AddFlag(flags, NetPermissionFlags::ForceRelay);
|
|
53
56
|
else if (permission == "mempool") NetPermissions::AddFlag(flags, NetPermissionFlags::Mempool);
|
|
@@ -55,6 +58,7 @@ static bool TryParsePermissionFlags(const std::string& str, NetPermissionFlags&
|
|
|
55
58
|
else if (permission == "all") NetPermissions::AddFlag(flags, NetPermissionFlags::All);
|
|
56
59
|
else if (permission == "relay") NetPermissions::AddFlag(flags, NetPermissionFlags::Relay);
|
|
57
60
|
else if (permission == "addr") NetPermissions::AddFlag(flags, NetPermissionFlags::Addr);
|
|
61
|
+
else if (permission == "forceinbound") NetPermissions::AddFlag(flags, NetPermissionFlags::ForceInbound);
|
|
58
62
|
else if (permission == "in") connection_direction |= ConnectionDirection::In;
|
|
59
63
|
else if (permission == "out") {
|
|
60
64
|
if (output_connection_direction == nullptr) {
|
|
@@ -92,6 +96,7 @@ static bool TryParsePermissionFlags(const std::string& str, NetPermissionFlags&
|
|
|
92
96
|
std::vector<std::string> NetPermissions::ToStrings(NetPermissionFlags flags)
|
|
93
97
|
{
|
|
94
98
|
std::vector<std::string> strings;
|
|
99
|
+
if (NetPermissions::HasFlag(flags, NetPermissionFlags::BlockFilters)) strings.emplace_back("blockfilters");
|
|
95
100
|
if (NetPermissions::HasFlag(flags, NetPermissionFlags::BloomFilter)) strings.emplace_back("bloomfilter");
|
|
96
101
|
if (NetPermissions::HasFlag(flags, NetPermissionFlags::NoBan)) strings.emplace_back("noban");
|
|
97
102
|
if (NetPermissions::HasFlag(flags, NetPermissionFlags::ForceRelay)) strings.emplace_back("forcerelay");
|