[Fix] The default whitelistrelay should be true

This commit is contained in:
nicolas.dorier 2019-08-16 17:45:13 +09:00
parent b80cdfec9a
commit ce7eac3cb0
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
4 changed files with 16 additions and 8 deletions

View file

@ -909,8 +909,8 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
bool legacyWhitelisted = false; bool legacyWhitelisted = false;
if (NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_ISIMPLICIT)) { if (NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_ISIMPLICIT)) {
NetPermissions::ClearFlag(permissionFlags, PF_ISIMPLICIT); NetPermissions::ClearFlag(permissionFlags, PF_ISIMPLICIT);
if (gArgs.GetBoolArg("-whitelistforcerelay", false)) NetPermissions::AddFlag(permissionFlags, PF_FORCERELAY); if (gArgs.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY)) NetPermissions::AddFlag(permissionFlags, PF_FORCERELAY);
if (gArgs.GetBoolArg("-whitelistrelay", false)) NetPermissions::AddFlag(permissionFlags, PF_RELAY); if (gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)) NetPermissions::AddFlag(permissionFlags, PF_RELAY);
NetPermissions::AddFlag(permissionFlags, PF_MEMPOOL); NetPermissions::AddFlag(permissionFlags, PF_MEMPOOL);
NetPermissions::AddFlag(permissionFlags, PF_NOBAN); NetPermissions::AddFlag(permissionFlags, PF_NOBAN);
legacyWhitelisted = true; legacyWhitelisted = true;

View file

@ -40,6 +40,11 @@ class CScheduler;
class CNode; class CNode;
class BanMan; 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). */ /** Time between pings automatically sent out for latency probing and keepalive (in seconds). */
static const int PING_INTERVAL = 2 * 60; static const int PING_INTERVAL = 2 * 60;
/** Time after which to disconnect, after waiting for a ping response (or inactivity). */ /** Time after which to disconnect, after waiting for a ping response (or inactivity). */

View file

@ -50,10 +50,6 @@ struct DisconnectedBlockTransactions;
struct PrecomputedTransactionData; struct PrecomputedTransactionData;
struct LockPoints; 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 */ /** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000; static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
/** Default for -limitancestorcount, max number of in-mempool ancestors */ /** Default for -limitancestorcount, max number of in-mempool ancestors */

View file

@ -22,12 +22,19 @@ class P2PPermissionsTests(BitcoinTestFramework):
self.extra_args = [[],[]] self.extra_args = [[],[]]
def run_test(self): def run_test(self):
self.checkpermission( self.checkpermission(
# relay permission added # default permissions (no specific permissions)
["-whitelist=127.0.0.1", "-whitelistrelay"], ["-whitelist=127.0.0.1"],
["relay", "noban", "mempool"], ["relay", "noban", "mempool"],
True) True)
self.checkpermission(
# relay permission removed (no specific permissions)
["-whitelist=127.0.0.1", "-whitelistrelay=0"],
["noban", "mempool"],
True)
self.checkpermission( self.checkpermission(
# forcerelay and relay permission added # forcerelay and relay permission added
# Legacy parameter interaction which set whitelistrelay to true # Legacy parameter interaction which set whitelistrelay to true