Skip to content

Commit 85ee55b

Browse files
committed
rpc: Remove chain-specific RequireRPCPassword
I've never liked the chain-specific exception to having to set a password. It gives issues with #6388 which makes it valid to set no password in every case (as it enables random cookie authentication). This pull removes the flag, so that all chains are regarded the same. It also removes the username==password test, which doesn't provide any substantial extra security.
1 parent 11576a5 commit 85ee55b

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

src/chainparams.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ class CMainParams : public CChainParams {
9999

100100
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
101101

102-
fRequireRPCPassword = true;
103102
fMiningRequiresPeers = true;
104103
fDefaultConsistencyChecks = false;
105104
fRequireStandard = true;
@@ -171,7 +170,6 @@ class CTestNetParams : public CMainParams {
171170

172171
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
173172

174-
fRequireRPCPassword = true;
175173
fMiningRequiresPeers = true;
176174
fDefaultConsistencyChecks = false;
177175
fRequireStandard = false;
@@ -218,7 +216,6 @@ class CRegTestParams : public CTestNetParams {
218216
vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
219217
vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds.
220218

221-
fRequireRPCPassword = false;
222219
fMiningRequiresPeers = false;
223220
fDefaultConsistencyChecks = true;
224221
fRequireStandard = false;

src/chainparams.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class CChainParams
5353
/** Used if GenerateBitcoins is called with a negative number of threads */
5454
int DefaultMinerThreads() const { return nMinerThreads; }
5555
const CBlock& GenesisBlock() const { return genesis; }
56-
bool RequireRPCPassword() const { return fRequireRPCPassword; }
5756
/** Make miner wait to have peers to avoid wasting work */
5857
bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
5958
/** Default value for -checkmempool and -checkblockindex argument */
@@ -86,7 +85,6 @@ class CChainParams
8685
std::string strNetworkID;
8786
CBlock genesis;
8887
std::vector<SeedSpec6> vFixedSeeds;
89-
bool fRequireRPCPassword;
9088
bool fMiningRequiresPeers;
9189
bool fDefaultConsistencyChecks;
9290
bool fRequireStandard;

src/rpcserver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,7 @@ void StartRPCThreads()
598598
LogPrint("rpc", "Allowing RPC connections from: %s\n", strAllowed);
599599

600600
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
601-
if (((mapArgs["-rpcpassword"] == "") ||
602-
(mapArgs["-rpcuser"] == mapArgs["-rpcpassword"])) && Params().RequireRPCPassword())
601+
if (mapArgs["-rpcpassword"] == "")
603602
{
604603
unsigned char rand_pwd[32];
605604
GetRandBytes(rand_pwd, 32);

0 commit comments

Comments
 (0)