init: Pass reference to ArgsManager around instead of relying on global

This commit is contained in:
MarcoFalke
2020-08-21 20:13:40 +02:00
parent 197450f808
commit fa40017706
5 changed files with 35 additions and 34 deletions

View File

@@ -50,11 +50,9 @@ static bool AppInit(int argc, char* argv[])
util::ThreadSetInternalName("init");
//
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
SetupServerArgs(node);
ArgsManager& args = *Assert(node.args);
std::string error;
if (!gArgs.ParseParameters(argc, argv, error)) {
return InitError(Untranslated(strprintf("Error parsing command line arguments: %s\n", error)));
@@ -109,15 +107,13 @@ static bool AppInit(int argc, char* argv[])
// -server defaults to true for bitcoind but not for the GUI so do this here
gArgs.SoftSetBoolArg("-server", true);
// Set this early so that parameter interactions go to console
InitLogging();
InitParameterInteraction();
if (!AppInitBasicSetup())
{
InitLogging(args);
InitParameterInteraction(args);
if (!AppInitBasicSetup(args)) {
// InitError will have been called with detailed error, which ends up on console
return false;
}
if (!AppInitParameterInteraction())
{
if (!AppInitParameterInteraction(args)) {
// InitError will have been called with detailed error, which ends up on console
return false;
}