Merge branch 'nolisten_bitcoin_conf_2' of https://github.com/dooglus/bitcoin
This commit is contained in:
commit
d3a4b85670
1 changed files with 21 additions and 11 deletions
32
src/util.cpp
32
src/util.cpp
|
@ -454,6 +454,21 @@ vector<unsigned char> ParseHex(const string& str)
|
||||||
return ParseHex(str.c_str());
|
return ParseHex(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void InterpretNegativeSetting(string name, map<string, string>& mapSettingsRet)
|
||||||
|
{
|
||||||
|
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
|
||||||
|
if (name.find("-no") == 0)
|
||||||
|
{
|
||||||
|
std::string positive("-");
|
||||||
|
positive.append(name.begin()+3, name.end());
|
||||||
|
if (mapSettingsRet.count(positive) == 0)
|
||||||
|
{
|
||||||
|
bool value = !GetBoolArg(name);
|
||||||
|
mapSettingsRet[positive] = (value ? "1" : "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ParseParameters(int argc, const char*const argv[])
|
void ParseParameters(int argc, const char*const argv[])
|
||||||
{
|
{
|
||||||
mapArgs.clear();
|
mapArgs.clear();
|
||||||
|
@ -494,17 +509,8 @@ void ParseParameters(int argc, const char*const argv[])
|
||||||
name = singleDash;
|
name = singleDash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1, as long as -foo not set)
|
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
|
||||||
if (name.find("-no") == 0)
|
InterpretNegativeSetting(name, mapArgs);
|
||||||
{
|
|
||||||
std::string positive("-");
|
|
||||||
positive.append(name.begin()+3, name.end());
|
|
||||||
if (mapArgs.count(positive) == 0)
|
|
||||||
{
|
|
||||||
bool value = !GetBoolArg(name);
|
|
||||||
mapArgs[positive] = (value ? "1" : "0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +926,11 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
|
||||||
// Don't overwrite existing settings so command line settings override bitcoin.conf
|
// Don't overwrite existing settings so command line settings override bitcoin.conf
|
||||||
string strKey = string("-") + it->string_key;
|
string strKey = string("-") + it->string_key;
|
||||||
if (mapSettingsRet.count(strKey) == 0)
|
if (mapSettingsRet.count(strKey) == 0)
|
||||||
|
{
|
||||||
mapSettingsRet[strKey] = it->value[0];
|
mapSettingsRet[strKey] = it->value[0];
|
||||||
|
// interpret nofoo=1 as foo=0 (and nofoo=0 as foo=1) as long as foo not set)
|
||||||
|
InterpretNegativeSetting(strKey, mapSettingsRet);
|
||||||
|
}
|
||||||
mapMultiSettingsRet[strKey].push_back(it->value[0]);
|
mapMultiSettingsRet[strKey].push_back(it->value[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue