Skip to content

Commit 35772b0

Browse files
committed
Be explicit whether config file is net specific
Remove the default for whether GetConfigFile and ReadConfigFile expects the file to be network specific or not, requiring true or false to be passed in for fNetworkSpecific on any call.
1 parent 690f5fa commit 35772b0

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

src/bitcoin-cli.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int AppInitRPC(int argc, char* argv[])
107107
return EXIT_FAILURE;
108108
}
109109
try {
110-
gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
110+
gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME), false);
111111
} catch (const std::exception& e) {
112112
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
113113
return EXIT_FAILURE;
@@ -326,8 +326,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co
326326
if (!GetAuthCookie(&strRPCUserColonPass)) {
327327
throw std::runtime_error(strprintf(
328328
_("Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (%s)"),
329-
GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string().c_str()));
330-
329+
GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME), false).string().c_str()));
331330
}
332331
} else {
333332
strRPCUserColonPass = gArgs.GetArg("-rpcuser", "") + ":" + gArgs.GetArg("-rpcpassword", "");

src/bitcoind.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool AppInit(int argc, char* argv[])
103103
}
104104
try
105105
{
106-
gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
106+
gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME), false);
107107
} catch (const std::exception& e) {
108108
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
109109
return false;

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12161216
LogPrintf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()));
12171217
LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());
12181218
LogPrintf("Using data directory %s\n", GetDataDir().string());
1219-
LogPrintf("Using config file %s\n", GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string());
1219+
LogPrintf("Using config file %s\n", GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME), false).string());
12201220
LogPrintf("Using network config file %s\n", GetConfigFile(gArgs.GetArg("-netconf", BITCOIN_NETCONF_FILENAME), true).string());
12211221
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
12221222

src/qt/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ int main(int argc, char *argv[])
627627
return EXIT_FAILURE;
628628
}
629629
try {
630-
gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
630+
gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME), false);
631631
} catch (const std::exception& e) {
632632
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
633633
QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));

src/qt/guiutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ void openDebugLogfile()
418418

419419
bool openBitcoinConf()
420420
{
421-
boost::filesystem::path pathConfig = GetConfigFile(BITCOIN_CONF_FILENAME);
421+
boost::filesystem::path pathConfig = GetConfigFile(BITCOIN_CONF_FILENAME, false);
422422

423423
/* Create the file */
424424
boost::filesystem::ofstream configFile(pathConfig, std::ios_base::app);

src/util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ bool TryCreateDirectories(const fs::path& p);
172172
fs::path GetDefaultDataDir();
173173
const fs::path &GetDataDir(bool fNetSpecific = true);
174174
void ClearDatadirCache();
175-
fs::path GetConfigFile(const std::string& confPath, bool fNetSpecific = false);
175+
fs::path GetConfigFile(const std::string& confPath, bool fNetSpecific);
176176
#ifndef WIN32
177177
fs::path GetPidFile();
178178
void CreatePidFile(const fs::path &path, pid_t pid);
@@ -201,7 +201,7 @@ class ArgsManager
201201
std::map<std::string, std::vector<std::string>> mapMultiArgs;
202202
public:
203203
void ParseParameters(int argc, const char*const argv[]);
204-
void ReadConfigFile(const std::string& confPath, bool fNetSpecific = false);
204+
void ReadConfigFile(const std::string& confPath, bool fNetSpecific);
205205

206206
/**
207207
* Return a vector of strings of the given argument

0 commit comments

Comments
 (0)