Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

init.h File Reference
#include <memory>
#include <string>
+ Include dependency graph for init.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  HelpMessageMode { HMM_BITCOIND, HMM_BITCOIN_QT }
 The help message mode determines what help message to show. More...
 

Functions

void StartShutdown ()
 
void StartRestart ()
 
bool ShutdownRequested ()
 
void Interrupt ()
 Interrupt threads. More...
 
void Shutdown ()
 Shutdown is split into 2 parts: Part 1: shut down everything but the main wallet instance (done in PrepareShutdown() ) Part 2: delete wallet instance. More...
 
void InitLogging ()
 Initialize the logging infrastructure. More...
 
void InitParameterInteraction ()
 Parameter interaction: change current parameters depending on various rules. More...
 
bool AppInitBasicSetup ()
 Initialize Dash Core: Basic context setup. More...
 
bool AppInitParameterInteraction ()
 Initialization: parameter interaction. More...
 
bool AppInitSanityChecks ()
 Initialization sanity checks: ecc init, sanity checks, dir lock. More...
 
bool AppInitLockDataDirectory ()
 Lock Dash Core data directory. More...
 
bool AppInitMain ()
 Dash Core main initialization. More...
 
void PrepareShutdown ()
 Preparing steps before shutting down or restarting the wallet. More...
 
std::string HelpMessage (HelpMessageMode mode)
 Help for options shared between UI and daemon (for -help) More...
 
std::string LicenseInfo ()
 Returns licensing information (for -version) More...
 

Variables

WalletInitInterface *const g_wallet_init_interface
 

Enumeration Type Documentation

◆ HelpMessageMode

The help message mode determines what help message to show.

Enumerator
HMM_BITCOIND 
HMM_BITCOIN_QT 

Definition at line 66 of file init.h.

Function Documentation

◆ AppInitBasicSetup()

bool AppInitBasicSetup ( )

Initialize Dash Core: Basic context setup.

Note
This can be done before daemonization. Do not call Shutdown() if this function fails.
Precondition
Parameters should be parsed and config file should be read.

Definition at line 1059 of file init.cpp.

References gArgs, ArgsManager::GetBoolArg(), HandleSIGHUP(), HandleSIGTERM(), InitError(), new_handler_terminate(), registerSignalHandler(), and SetupNetworking().

Referenced by AppInit(), and BitcoinCore::baseInitialize().

◆ AppInitLockDataDirectory()

bool AppInitLockDataDirectory ( )

Lock Dash Core data directory.

Note
This should only be done after daemonization. Do not call Shutdown() if this function fails.
Precondition
Parameters should be parsed and config file should be read, AppInitSanityChecks should have been called.

Definition at line 1574 of file init.cpp.

References LockDataDirectory().

Referenced by AppInit(), and BitcoinCore::baseInitialize().

◆ AppInitMain()

bool AppInitMain ( )

Dash Core main initialization.

Note
This should only be done after daemonization. Call Shutdown() if this function fails.
Precondition
Parameters should be parsed and config file should be read, AppInitLockDataDirectory should have been called.

Definition at line 1586 of file init.cpp.

References _(), activeMasternodeInfo, activeMasternodeManager, AddLocal(), AppInitServers(), BITCOIN_CONF_FILENAME, BlockNotifyCallback(), BlockNotifyGenesisWait(), CActiveMasternodeInfo::blsKeyOperator, CActiveMasternodeInfo::blsPubKeyOperator, CClientUIInterface::BTN_ABORT, chainActive, CheckDiskSpace(), CleanupBlockRevFiles(), CLIENT_NAME, CLIENT_VERSION, condvar_GenesisWait, CZMQNotificationInterface::Create(), CreatePidFile(), cs_GenesisWait, cs_main, DateTimeStrFormat(), DEFAULT_ADDRESSINDEX, DEFAULT_BLOCKSONLY, DEFAULT_CHECKBLOCKS, DEFAULT_CHECKLEVEL, DEFAULT_LISTEN, DEFAULT_LISTEN_ONION, DEFAULT_MAX_MEMPOOL_SIZE, DEFAULT_MAX_UPLOAD_TARGET, DEFAULT_MAXRECEIVEBUFFER, DEFAULT_MAXSENDBUFFER, DEFAULT_NAME_LOOKUP, DEFAULT_PROXYRANDOMIZE, DEFAULT_SOCKETEVENTS, DEFAULT_SPENTINDEX, DEFAULT_TIMESTAMPINDEX, DEFAULT_TXINDEX, DEFAULT_UPNP, llmq::DestroyLLMQSystem(), deterministicMNManager, CBaseChainParams::DEVNET, Discover(), CMasternodeUtils::DoMaintenance(), CNetFulfilledRequestManager::DoMaintenance(), CMasternodeSync::DoMaintenance(), CPrivateSendServer::DoMaintenance(), CGovernanceManager::DoMaintenance(), CFlatDB< T >::Dump(), evoDb, fAddressIndex, fDisableGovernance, fDiscover, FEE_ESTIMATES_FILENAME, feeEstimator, fFeeEstimatesInitialized, fHaveGenesis, fHavePruned, fListen, fLogTimestamps, fMasternodeMode, fNameLookup, fsbridge::fopen(), FormatSubVersion(), fPrintToDebugLog, fPruneMode, fReindex, fRelayTxes, fRequestShutdown(), fSpentIndex, fTimestampIndex, fTxIndex, g_connman, g_wallet_init_interface, gArgs, GetAdjustedTime(), ArgsManager::GetArg(), ArgsManager::GetArgs(), ArgsManager::GetBoolArg(), GetConfigFile(), CChainParams::GetConsensus(), GetDataDir(), GetDebugLogPath(), GetDefaultDataDir(), ArgsManager::GetDevNetName(), GetListenPort(), GetMainSignals(), GetPidFile(), CService::GetPort(), CBLSSecretKey::GetPublicKey(), GetRand(), GetSupportedSocketEventsStr(), GetTime(), GetTimeMillis(), governance, Consensus::Params::hashDevnetGenesisBlock, Consensus::Params::hashGenesisBlock, CChain::Height(), WalletInitInterface::InitAutoBackup(), InitError(), WalletInitInterface::InitKeePass(), llmq::InitLLMQSystem(), CClientUIInterface::InitMessage, CGovernanceManager::InitOnLoad(), WalletInitInterface::InitPrivateSendSettings(), InitScriptExecutionCache(), InitSignatureCache(), CPrivateSend::InitStandardDenominations(), ArgsManager::IsArgSet(), base_blob< BITS >::IsNull(), CAutoFile::IsNull(), proxyType::IsValid(), CNetAddr::IsValid(), CBLSWrapper< ImplType, _SerSize, C >::IsValid(), CSubNet::IsValid(), CFlatDB< T >::Load(), LoadBlockIndex(), LoadChainTip(), LoadGenesisBlock(), LOCAL_MANUAL, LOCK, logCategories, LogPrintf, Lookup(), LookupSubNet(), mapBlockIndex, MapPort(), masternodeSync, MAX_ADDNODE_CONNECTIONS, MAX_OUTBOUND_CONNECTIONS, MAX_SUBVERSION_LENGTH, MAX_UPLOAD_TIMEFRAME, mempool, MIN_BLOCKS_TO_KEEP, mmetaman, CClientUIInterface::MSG_ERROR, nCoinCacheUsage, nDefaultDbCache, NET_IPV4, NET_IPV6, NET_MAX, NET_TOR, NET_UNROUTABLE, netfulfilledman, CChainParams::NetworkIDString(), CConnman::Options::nLocalServices, nMaxBlockDBAndTxIndexCache, nMaxBlockDBCache, nMaxCoinsDBCache, nMaxDbCache, nMinDbCache, NODE_NETWORK, BCLog::NONE, CClientUIInterface::NotifyBlockTip, nScriptCheckThreads, CBlockIndex::nTime, WalletInitInterface::Open(), OpenDebugLog(), Params(), ParseHex(), ParseNetwork(), pblocktree, pcoinscatcher, pcoinsdbview, pcoinsTip, pdsNotificationInterface, peerLogic, privateSendServer, PruneAndFlush(), CBlockPolicyEstimator::Read(), RegisterAllCoreRPCCommands(), CMainSignals::RegisterBackgroundSignalScheduler(), WalletInitInterface::RegisterRPC(), RegisterValidationInterface(), CMainSignals::RegisterWithMempoolSignals(), CBaseChainParams::REGTEST, ReplayBlocks(), ResolveErrMsg(), RPCNotifyBlockChange(), SAFE_CHARS_UA_COMMENT, SanitizeString(), CScheduler::scheduleEvery(), scheduler, SER_DISK, CScheduler::serviceQueue(), CBLSWrapper< ImplType, _SerSize, C >::SetBuf(), SetLimited(), CSporkManager::SetMinSporkKeys(), SetNameProxy(), CSporkManager::SetPrivKey(), SetProxy(), SetRPCWarmupFinished(), SetRPCWarmupStatus(), CSporkManager::SetSporkAddress(), ShrinkDebugFile(), ShutdownRequested(), CConnman::SOCKETEVENTS_EPOLL, CConnman::SOCKETEVENTS_POLL, CConnman::SOCKETEVENTS_SELECT, CChainParams::SporkAddresses(), sporkManager, WalletInitInterface::Start(), llmq::StartLLMQSystem(), StartTorControl(), strprintf, strSubVersion, tableRPC, threadGroup, ThreadImport(), CClientUIInterface::ThreadSafeQuestion, ThreadScriptCheck(), CChain::Tip(), CBLSWrapper< ImplType, _SerSize, C >::ToString(), uiInterface, UnloadBlockIndex(), and WalletInitInterface::Verify().

Referenced by AppInit(), and BitcoinCore::initialize().

◆ AppInitParameterInteraction()

bool AppInitParameterInteraction ( )

Initialization: parameter interaction.

Note
This can be done before daemonization. Do not call Shutdown() if this function fails.
Precondition
Parameters should be parsed and config file should be read, AppInitBasicSetup should have been called.

Definition at line 1109 of file init.cpp.

References _(), AmountErrMsg(), DEFAULT_ACCEPT_DATACARRIER, DEFAULT_ALLOWPRIVATENET, DEFAULT_CHECKPOINTS_ENABLED, DEFAULT_CONNECT_TIMEOUT, DEFAULT_DESCENDANT_SIZE_LIMIT, DEFAULT_ENABLE_BIP61, DEFAULT_LISTEN, DEFAULT_MAX_MEMPOOL_SIZE, DEFAULT_MAX_PEER_CONNECTIONS, DEFAULT_MAX_TIP_AGE, DEFAULT_PEERBLOOMFILTERS, DEFAULT_PERMIT_BAREMULTISIG, DEFAULT_SCRIPTCHECK_THREADS, DEFAULT_TXINDEX, Consensus::Params::defaultAssumeValid, CChainParams::DefaultConsistencyChecks(), CBaseChainParams::DEVNET, dustRelayFee, fAcceptDatacarrier, fAllowPrivateNet, fCheckBlockIndex, fCheckpointsEnabled, fDisableGovernance, fIsBareMultisigStd, ArgsManager::ForceRemoveArg(), fPruneMode, fRequireStandard, g_enable_bip61, g_wallet_init_interface, gArgs, ArgsManager::GetArg(), ArgsManager::GetArgs(), ArgsManager::GetBoolArg(), CChainParams::GetConsensus(), base_blob< BITS >::GetHex(), base_uint< BITS >::GetHex(), GetLogCategory(), GetNumCores(), hashAssumeValid, incrementalRelayFee, InitError(), InitWarning(), ArgsManager::IsArgSet(), IsHexNumber(), base_blob< BITS >::IsNull(), Consensus::LLMQ_NONE, Consensus::Params::llmqs, logCategories, LogPrintf, MAX_ADDNODE_CONNECTIONS, MAX_SCRIPTCHECK_THREADS, Consensus::MAX_VERSION_BITS_DEPLOYMENTS, mempool, MIN_CORE_FILEDESCRIPTORS, MIN_DISK_SPACE_FOR_BLOCK_FILES, CChainParams::MineBlocksOnDemand(), minRelayTxFee, name, nBytesPerSigOp, nConnectTimeout, CChainParams::NetworkIDString(), Consensus::Params::nHighSubsidyBlocks, Consensus::Params::nHighSubsidyFactor, nMaxDatacarrierBytes, nMaxTipAge, Consensus::Params::nMinimumChainWork, nMinimumChainWork, Consensus::Params::nMinimumDifficultyBlocks, NODE_BLOOM, nPruneTarget, nScriptCheckThreads, WalletInitInterface::ParameterInteraction(), Params(), ParseInt32(), ParseInt64(), ParseMoney(), RaiseFileDescriptorLimit(), CBaseChainParams::REGTEST, CChainParams::RequireRoutableExternalIP(), CChainParams::RequireStandard(), SetMockTime(), CTxMemPool::setSanityCheck(), strprintf, CFeeRate::ToString(), uint256S(), UintToArith256(), UpdateBudgetParameters(), UpdateDevnetLLMQChainLocks(), UpdateDevnetSubsidyAndDiffParams(), UpdateDIP3Parameters(), UpdateLLMQDevnetParams(), UpdateLLMQTestParams(), UpdateVersionBitsParameters(), and VersionBitsDeploymentInfo.

Referenced by AppInit(), and BitcoinCore::baseInitialize().

◆ AppInitSanityChecks()

bool AppInitSanityChecks ( )

Initialization sanity checks: ecc init, sanity checks, dir lock.

Note
This can be done before daemonization. Do not call Shutdown() if this function fails.
Precondition
Parameters should be parsed and config file should be read, AppInitParameterInteraction should have been called.

Definition at line 1553 of file init.cpp.

References _(), ECC_Start(), globalVerifyHandle, InitError(), InitSanityCheck(), LockDataDirectory(), LogPrintf, RandomInit(), SHA256AutoDetect(), and strprintf.

Referenced by AppInit(), and BitcoinCore::baseInitialize().

◆ HelpMessage()

std::string HelpMessage ( HelpMessageMode  mode)

Help for options shared between UI and daemon (for -help)

Definition at line 449 of file init.cpp.

References _(), AppendParamsHelpMessages(), BITCOIN_CONF_FILENAME, BITCOIN_PID_FILENAME, CreateBaseChainParams(), CreateChainParams(), CURRENCY_UNIT, DEFAULT_ACCEPT_DATACARRIER, DEFAULT_ADDRESSINDEX, DEFAULT_ALLOWPRIVATENET, DEFAULT_ANCESTOR_LIMIT, DEFAULT_ANCESTOR_SIZE_LIMIT, DEFAULT_BANSCORE_THRESHOLD, DEFAULT_BLOCK_MAX_SIZE, DEFAULT_BLOCK_MIN_TX_FEE, DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN, DEFAULT_BLOCKSONLY, DEFAULT_BYTES_PER_SIGOP, DEFAULT_CHECKBLOCKS, DEFAULT_CHECKLEVEL, DEFAULT_CHECKPOINTS_ENABLED, DEFAULT_CONNECT_TIMEOUT, DEFAULT_DEBUGLOGFILE, DEFAULT_DESCENDANT_LIMIT, DEFAULT_DESCENDANT_SIZE_LIMIT, DEFAULT_DISABLE_SAFEMODE, DEFAULT_ENABLE_BIP61, DEFAULT_FORCEDNSSEED, DEFAULT_HTTP_SERVER_TIMEOUT, DEFAULT_HTTP_THREADS, DEFAULT_HTTP_WORKQUEUE, DEFAULT_INCREMENTAL_RELAY_FEE, DEFAULT_LISTEN_ONION, DEFAULT_LOGIPS, DEFAULT_LOGTHREADNAMES, DEFAULT_LOGTIMEMICROS, DEFAULT_LOGTIMESTAMPS, DEFAULT_MAX_MEMPOOL_SIZE, DEFAULT_MAX_ORPHAN_TRANSACTIONS_SIZE, DEFAULT_MAX_PEER_CONNECTIONS, DEFAULT_MAX_SIG_CACHE_SIZE, DEFAULT_MAX_TIME_ADJUSTMENT, DEFAULT_MAX_TIP_AGE, DEFAULT_MAX_UPLOAD_TARGET, DEFAULT_MAXRECEIVEBUFFER, DEFAULT_MAXSENDBUFFER, DEFAULT_MEMPOOL_EXPIRY, DEFAULT_MIN_RELAY_TX_FEE, DEFAULT_MISBEHAVING_BANTIME, DEFAULT_NAME_LOOKUP, DEFAULT_PEERBLOOMFILTERS, DEFAULT_PERMIT_BAREMULTISIG, DEFAULT_PERSIST_MEMPOOL, DEFAULT_PRINTPRIORITY, DEFAULT_PROXYRANDOMIZE, DEFAULT_REST_ENABLE, DEFAULT_SCRIPTCHECK_THREADS, DEFAULT_SOCKETEVENTS, DEFAULT_SPENTINDEX, DEFAULT_STOPAFTERBLOCKIMPORT, DEFAULT_STOPATHEIGHT, DEFAULT_SYNC_MEMPOOL, DEFAULT_TESTSAFEMODE, DEFAULT_TIMESTAMPINDEX, DEFAULT_TOR_CONTROL, DEFAULT_TRANSACTION_MAXFEE, DEFAULT_TXINDEX, llmq::DEFAULT_WATCH_QUORUMS, DEFAULT_WHITELISTFORCERELAY, DEFAULT_WHITELISTRELAY, DUST_RELAY_TX_FEE, FormatMoney(), g_wallet_init_interface, gArgs, ArgsManager::GetBoolArg(), WalletInitInterface::GetHelpString(), GetNumCores(), GetSupportedSocketEventsStr(), HelpMessageGroup(), HelpMessageOpt(), HMM_BITCOIN_QT, HMM_BITCOIND, ListLogCategories(), CBaseChainParams::MAIN, MAX_OP_RETURN_RELAY, MAX_SCRIPTCHECK_THREADS, MIN_DISK_SPACE_FOR_BLOCK_FILES, nDefaultDbBatchSize, nDefaultDbCache, nMaxDbCache, nMinDbCache, strprintf, and CBaseChainParams::TESTNET.

Referenced by AppInit(), and HelpMessageDialog::HelpMessageDialog().

◆ InitLogging()

◆ InitParameterInteraction()

◆ Interrupt()

◆ LicenseInfo()

std::string LicenseInfo ( )

Returns licensing information (for -version)

Definition at line 669 of file init.cpp.

References _(), CopyrightHolders(), and strprintf.

Referenced by AppInit(), and HelpMessageDialog::HelpMessageDialog().

◆ PrepareShutdown()

void PrepareShutdown ( )

Preparing steps before shutting down or restarting the wallet.

Note: Shutdown() must be able to handle cases in which initialization failed part of the way, for example if the data directory was found to be locked. Be sure that anything that writes files or flushes caches only does this if the respective module was initialized.

Definition at line 228 of file init.cpp.

References activeMasternodeInfo, activeMasternodeManager, CTxMemPool::AddTransactionsUpdated(), CActiveMasternodeInfo::blsKeyOperator, CActiveMasternodeInfo::blsPubKeyOperator, CLIENT_VERSION, cs_main, DEFAULT_PERSIST_MEMPOOL, llmq::DestroyLLMQSystem(), deterministicMNManager, CFlatDB< T >::Dump(), DumpMempool(), evoDb, fDisableGovernance, fDumpMempoolLater(), FEE_ESTIMATES_FILENAME, feeEstimator, fFeeEstimatesInitialized, WalletInitInterface::Flush(), CMainSignals::FlushBackgroundCallbacks(), FlushStateToDisk(), CBlockPolicyEstimator::FlushUnconfirmed(), fMasternodeMode, fsbridge::fopen(), fRPCInWarmup, g_connman, g_wallet_init_interface, gArgs, ArgsManager::GetArg(), GetDataDir(), GetMainSignals(), GetPidFile(), governance, CAutoFile::IsNull(), LOCK, LogPrintf, MapPort(), mempool, mmetaman, netfulfilledman, pblocktree, pcoinscatcher, pcoinsdbview, pcoinsTip, pdsNotificationInterface, peerLogic, RenameThread(), RPCIsInWarmup(), SER_DISK, sporkManager, WalletInitInterface::Stop(), StopHTTPRPC(), StopHTTPServer(), llmq::StopLLMQSystem(), StopREST(), StopRPC(), threadGroup, TRY_LOCK, UnregisterAllValidationInterfaces(), CMainSignals::UnregisterBackgroundSignalScheduler(), UnregisterValidationInterface(), CMainSignals::UnregisterWithMempoolSignals(), and CBlockPolicyEstimator::Write().

Referenced by BitcoinCore::restart(), and Shutdown().

◆ Shutdown()

void Shutdown ( )

Shutdown is split into 2 parts: Part 1: shut down everything but the main wallet instance (done in PrepareShutdown() ) Part 2: delete wallet instance.

In case of a restart PrepareShutdown() was already called before, but this method here gets called implicitly when the parent object is deleted. In this case we have to skip the PrepareShutdown() part because it was already executed and just delete the wallet instance.

Definition at line 375 of file init.cpp.

References WalletInitInterface::Close(), ECC_Stop(), fRequestRestart(), g_wallet_init_interface, globalVerifyHandle, LogPrintf, PrepareShutdown(), and StopTorControl().

Referenced by AppInit(), and BitcoinCore::shutdown().

◆ ShutdownRequested()

◆ StartRestart()

void StartRestart ( )

Definition at line 175 of file init.cpp.

References fRequestRestart(), and fRequestShutdown().

Referenced by BitcoinCore::restart().

◆ StartShutdown()

Variable Documentation

◆ g_wallet_init_interface

WalletInitInterface* const g_wallet_init_interface
Released under the MIT license