|
|
|
@ -102,6 +102,7 @@ using namespace std;
|
|
|
|
|
const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
|
|
|
|
|
const char * const BITCOIN_PID_FILENAME = "bitcoind.pid";
|
|
|
|
|
|
|
|
|
|
CCriticalSection cs_args;
|
|
|
|
|
map<string, string> mapArgs;
|
|
|
|
|
static map<string, vector<string> > _mapMultiArgs;
|
|
|
|
|
const map<string, vector<string> >& mapMultiArgs = _mapMultiArgs;
|
|
|
|
@ -346,6 +347,7 @@ static void InterpretNegativeSetting(std::string& strKey, std::string& strValue)
|
|
|
|
|
|
|
|
|
|
void ParseParameters(int argc, const char* const argv[])
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
mapArgs.clear();
|
|
|
|
|
_mapMultiArgs.clear();
|
|
|
|
|
|
|
|
|
@ -381,11 +383,13 @@ void ParseParameters(int argc, const char* const argv[])
|
|
|
|
|
|
|
|
|
|
bool IsArgSet(const std::string& strArg)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
return mapArgs.count(strArg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetArg(const std::string& strArg, const std::string& strDefault)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
if (mapArgs.count(strArg))
|
|
|
|
|
return mapArgs[strArg];
|
|
|
|
|
return strDefault;
|
|
|
|
@ -393,6 +397,7 @@ std::string GetArg(const std::string& strArg, const std::string& strDefault)
|
|
|
|
|
|
|
|
|
|
int64_t GetArg(const std::string& strArg, int64_t nDefault)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
if (mapArgs.count(strArg))
|
|
|
|
|
return atoi64(mapArgs[strArg]);
|
|
|
|
|
return nDefault;
|
|
|
|
@ -400,6 +405,7 @@ int64_t GetArg(const std::string& strArg, int64_t nDefault)
|
|
|
|
|
|
|
|
|
|
bool GetBoolArg(const std::string& strArg, bool fDefault)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
if (mapArgs.count(strArg))
|
|
|
|
|
return InterpretBool(mapArgs[strArg]);
|
|
|
|
|
return fDefault;
|
|
|
|
@ -407,6 +413,7 @@ bool GetBoolArg(const std::string& strArg, bool fDefault)
|
|
|
|
|
|
|
|
|
|
bool SoftSetArg(const std::string& strArg, const std::string& strValue)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
if (mapArgs.count(strArg))
|
|
|
|
|
return false;
|
|
|
|
|
mapArgs[strArg] = strValue;
|
|
|
|
@ -522,6 +529,8 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
|
|
|
|
|
|
|
|
|
void ClearDatadirCache()
|
|
|
|
|
{
|
|
|
|
|
LOCK(csPathCached);
|
|
|
|
|
|
|
|
|
|
pathCached = boost::filesystem::path();
|
|
|
|
|
pathCachedNetSpecific = boost::filesystem::path();
|
|
|
|
|
}
|
|
|
|
@ -541,6 +550,8 @@ void ReadConfigFile(const std::string& confPath)
|
|
|
|
|
if (!streamConfig.good())
|
|
|
|
|
return; // No bitcoin.conf file is OK
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_args);
|
|
|
|
|
set<string> setOptions;
|
|
|
|
|
setOptions.insert("*");
|
|
|
|
|
|
|
|
|
@ -554,6 +565,7 @@ void ReadConfigFile(const std::string& confPath)
|
|
|
|
|
mapArgs[strKey] = strValue;
|
|
|
|
|
_mapMultiArgs[strKey].push_back(strValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// If datadir is changed in .conf file:
|
|
|
|
|
ClearDatadirCache();
|
|
|
|
|
}
|
|
|
|
|