aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net.cpp4
-rw-r--r--src/net.h5
-rw-r--r--src/validation.h4
-rw-r--r--test/functional/p2p_permissions.py11
4 files changed, 16 insertions, 8 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 0391edadaa..337d1f6a46 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -909,8 +909,8 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
bool legacyWhitelisted = false;
if (NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_ISIMPLICIT)) {
NetPermissions::ClearFlag(permissionFlags, PF_ISIMPLICIT);
- if (gArgs.GetBoolArg("-whitelistforcerelay", false)) NetPermissions::AddFlag(permissionFlags, PF_FORCERELAY);
- if (gArgs.GetBoolArg("-whitelistrelay", false)) NetPermissions::AddFlag(permissionFlags, PF_RELAY);
+ if (gArgs.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY)) NetPermissions::AddFlag(permissionFlags, PF_FORCERELAY);
+ if (gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)) NetPermissions::AddFlag(permissionFlags, PF_RELAY);
NetPermissions::AddFlag(permissionFlags, PF_MEMPOOL);
NetPermissions::AddFlag(permissionFlags, PF_NOBAN);
legacyWhitelisted = true;
diff --git a/src/net.h b/src/net.h
index 75c05c9cb5..6c77d8135f 100644
--- a/src/net.h
+++ b/src/net.h
@@ -40,6 +40,11 @@ class CScheduler;
class CNode;
class BanMan;
+/** Default for -whitelistrelay. */
+static const bool DEFAULT_WHITELISTRELAY = true;
+/** Default for -whitelistforcerelay. */
+static const bool DEFAULT_WHITELISTFORCERELAY = false;
+
/** Time between pings automatically sent out for latency probing and keepalive (in seconds). */
static const int PING_INTERVAL = 2 * 60;
/** Time after which to disconnect, after waiting for a ping response (or inactivity). */
diff --git a/src/validation.h b/src/validation.h
index 7cf3311f22..99850f71d9 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -50,10 +50,6 @@ struct DisconnectedBlockTransactions;
struct PrecomputedTransactionData;
struct LockPoints;
-/** Default for -whitelistrelay. */
-static const bool DEFAULT_WHITELISTRELAY = true;
-/** Default for -whitelistforcerelay. */
-static const bool DEFAULT_WHITELISTFORCERELAY = false;
/** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
/** Default for -limitancestorcount, max number of in-mempool ancestors */
diff --git a/test/functional/p2p_permissions.py b/test/functional/p2p_permissions.py
index 1013055420..24bd8cae95 100644
--- a/test/functional/p2p_permissions.py
+++ b/test/functional/p2p_permissions.py
@@ -22,13 +22,20 @@ class P2PPermissionsTests(BitcoinTestFramework):
self.extra_args = [[],[]]
def run_test(self):
+
self.checkpermission(
- # relay permission added
- ["-whitelist=127.0.0.1", "-whitelistrelay"],
+ # default permissions (no specific permissions)
+ ["-whitelist=127.0.0.1"],
["relay", "noban", "mempool"],
True)
self.checkpermission(
+ # relay permission removed (no specific permissions)
+ ["-whitelist=127.0.0.1", "-whitelistrelay=0"],
+ ["noban", "mempool"],
+ True)
+
+ self.checkpermission(
# forcerelay and relay permission added
# Legacy parameter interaction which set whitelistrelay to true
# if whitelistforcerelay is true