aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoind.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-10-25 11:34:27 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-11-29 12:47:13 +0100
commit0cc8b6bc44bea29e24fa4e13d8a9bbe4f1483680 (patch)
tree8688518c33a37cd755b81103c72b2cb69efbcad6 /src/bitcoind.cpp
parent67728a389ccf128fc25262668b2a23f8ef73e1d6 (diff)
downloadbitcoin-0cc8b6bc44bea29e24fa4e13d8a9bbe4f1483680.tar.xz
init: Split up AppInit2 into multiple phases
This allows doing some of the steps before e.g. daemonization and some fater.
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r--src/bitcoind.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 351463c256..a89b8cd4ee 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -128,6 +128,26 @@ bool AppInit(int argc, char* argv[])
fprintf(stderr, "Error: There is no RPC client functionality in bitcoind anymore. Use the bitcoin-cli utility instead.\n");
exit(1);
}
+ // -server defaults to true for bitcoind but not for the GUI so do this here
+ SoftSetBoolArg("-server", true);
+ // Set this early so that parameter interactions go to console
+ InitLogging();
+ InitParameterInteraction();
+ if (!AppInitBasicSetup())
+ {
+ // InitError will have been called with detailed error, which ends up on console
+ exit(1);
+ }
+ if (!AppInitParameterInteraction())
+ {
+ // InitError will have been called with detailed error, which ends up on console
+ exit(1);
+ }
+ if (!AppInitSanityChecks())
+ {
+ // InitError will have been called with detailed error, which ends up on console
+ exit(1);
+ }
if (GetBoolArg("-daemon", false))
{
#if HAVE_DECL_DAEMON
@@ -143,12 +163,8 @@ bool AppInit(int argc, char* argv[])
return false;
#endif // HAVE_DECL_DAEMON
}
- SoftSetBoolArg("-server", true);
- // Set this early so that parameter interactions go to console
- InitLogging();
- InitParameterInteraction();
- fRet = AppInit2(threadGroup, scheduler);
+ fRet = AppInitMain(threadGroup, scheduler);
}
catch (const std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");