Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,353 Lines • ▼ Show 20 Lines | #ifndef WIN32 | ||||
signal(SIGPIPE, SIG_IGN); | signal(SIGPIPE, SIG_IGN); | ||||
#endif | #endif | ||||
std::set_new_handler(new_handler_terminate); | std::set_new_handler(new_handler_terminate); | ||||
return true; | return true; | ||||
} | } | ||||
bool AppInitParameterInteraction(Config &config, RPCServer &rpcServer) { | bool AppInitParameterInteraction(Config &config) { | ||||
const CChainParams &chainparams = config.GetChainParams(); | const CChainParams &chainparams = config.GetChainParams(); | ||||
// Step 2: parameter interactions | // Step 2: parameter interactions | ||||
// also see: InitParameterInteraction() | // also see: InitParameterInteraction() | ||||
if (!fs::is_directory(GetBlocksDir(false))) { | if (!fs::is_directory(GetBlocksDir(false))) { | ||||
return InitError( | return InitError( | ||||
strprintf(_("Specified blocks directory \"%s\" does not exist.\n"), | strprintf(_("Specified blocks directory \"%s\" does not exist.\n"), | ||||
▲ Show 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | if (nPruneArg == 1) { | ||||
MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); | MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); | ||||
} | } | ||||
LogPrintf("Prune configured to target %uMiB on disk for block and undo " | LogPrintf("Prune configured to target %uMiB on disk for block and undo " | ||||
"files.\n", | "files.\n", | ||||
nPruneTarget / 1024 / 1024); | nPruneTarget / 1024 / 1024); | ||||
fPruneMode = true; | fPruneMode = true; | ||||
} | } | ||||
RegisterAllRPCCommands(config, rpcServer, tableRPC); | |||||
g_wallet_init_interface->RegisterRPC(tableRPC); | |||||
nConnectTimeout = gArgs.GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT); | nConnectTimeout = gArgs.GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT); | ||||
if (nConnectTimeout <= 0) { | if (nConnectTimeout <= 0) { | ||||
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; | nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; | ||||
} | } | ||||
// Obtain the amount to charge excess UTXO | // Obtain the amount to charge excess UTXO | ||||
if (gArgs.IsArgSet("-excessutxocharge")) { | if (gArgs.IsArgSet("-excessutxocharge")) { | ||||
Amount n = Amount::zero(); | Amount n = Amount::zero(); | ||||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | bool AppInitLockDataDirectory() { | ||||
// printing a message to console. | // printing a message to console. | ||||
if (!LockDataDirectory(false)) { | if (!LockDataDirectory(false)) { | ||||
// Detailed error printed inside LockDataDirectory | // Detailed error printed inside LockDataDirectory | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool AppInitMain(Config &config, | bool AppInitMain(Config &config, RPCServer &rpcServer, | ||||
HTTPRPCRequestProcessor &httpRPCRequestProcessor) { | HTTPRPCRequestProcessor &httpRPCRequestProcessor) { | ||||
// Step 4a: application initialization | // Step 4a: application initialization | ||||
const CChainParams &chainparams = config.GetChainParams(); | const CChainParams &chainparams = config.GetChainParams(); | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
CreatePidFile(GetPidFile(), getpid()); | CreatePidFile(GetPidFile(), getpid()); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | CScheduler::Function serviceLoop = | ||||
boost::bind(&CScheduler::serviceQueue, &scheduler); | boost::bind(&CScheduler::serviceQueue, &scheduler); | ||||
threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, | threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, | ||||
"scheduler", serviceLoop)); | "scheduler", serviceLoop)); | ||||
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler); | GetMainSignals().RegisterBackgroundSignalScheduler(scheduler); | ||||
GetMainSignals().RegisterWithMempoolSignals(g_mempool); | GetMainSignals().RegisterWithMempoolSignals(g_mempool); | ||||
/** | /** | ||||
* Register RPC commands regardless of -server setting so they will be | |||||
* available in the GUI RPC console even if external calls are disabled. | |||||
*/ | |||||
RegisterAllRPCCommands(config, rpcServer, tableRPC); | |||||
g_wallet_init_interface->RegisterRPC(tableRPC); | |||||
/** | |||||
* Start the RPC server. It will be started in "warmup" mode and not | * Start the RPC server. It will be started in "warmup" mode and not | ||||
* process calls yet (but it will verify that the server is there and will | * process calls yet (but it will verify that the server is there and will | ||||
* be ready later). Warmup mode will be completed when initialisation is | * be ready later). Warmup mode will be completed when initialisation is | ||||
* finished. | * finished. | ||||
*/ | */ | ||||
if (gArgs.GetBoolArg("-server", false)) { | if (gArgs.GetBoolArg("-server", false)) { | ||||
uiInterface.InitMessage.connect(SetRPCWarmupStatus); | uiInterface.InitMessage.connect(SetRPCWarmupStatus); | ||||
if (!AppInitServers(config, httpRPCRequestProcessor)) { | if (!AppInitServers(config, httpRPCRequestProcessor)) { | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |