Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

init.cpp File Reference
#include <init.h>
#include <addrman.h>
#include <amount.h>
#include <base58.h>
#include <chain.h>
#include <chainparams.h>
#include <checkpoints.h>
#include <compat/sanity.h>
#include <consensus/validation.h>
#include <fs.h>
#include <httpserver.h>
#include <httprpc.h>
#include <key.h>
#include <validation.h>
#include <miner.h>
#include <netbase.h>
#include <net.h>
#include <net_processing.h>
#include <policy/feerate.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <rpc/server.h>
#include <rpc/register.h>
#include <rpc/safemode.h>
#include <rpc/blockchain.h>
#include <script/standard.h>
#include <script/sigcache.h>
#include <scheduler.h>
#include <timedata.h>
#include <txdb.h>
#include <txmempool.h>
#include <torcontrol.h>
#include <ui_interface.h>
#include <util.h>
#include <utilmoneystr.h>
#include <validationinterface.h>
#include <masternode/activemasternode.h>
#include <dsnotificationinterface.h>
#include <flat-database.h>
#include <governance/governance.h>
#include <masternode/masternode-meta.h>
#include <masternode/masternode-payments.h>
#include <masternode/masternode-sync.h>
#include <masternode/masternode-utils.h>
#include <messagesigner.h>
#include <netfulfilledman.h>
#include <privatesend/privatesend-server.h>
#include <spork.h>
#include <warnings.h>
#include <walletinitinterface.h>
#include <evo/deterministicmns.h>
#include <llmq/quorums_init.h>
#include <stdint.h>
#include <stdio.h>
#include <memory>
#include <bls/bls.h>
#include <signal.h>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/bind.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/thread.hpp>
#include <openssl/crypto.h>

Go to the source code of this file.

Classes

class  DummyWalletInit
 
class  CCoinsViewErrorCatcher
 This is a minimally invasive approach to shutdown on LevelDB read errors from the chainstate, while keeping user interface out of the common library, which is shared between dashd, and dash-qt and non-server tools. More...
 
struct  CImportingNow
 

Macros

#define MIN_CORE_FILEDESCRIPTORS   150
 

Functions

std::atomic< bool > fRequestShutdown (false)
 
std::atomic< bool > fRequestRestart (false)
 
std::atomic< bool > fDumpMempoolLater (false)
 
void StartShutdown ()
 
void StartRestart ()
 
bool ShutdownRequested ()
 
void Interrupt ()
 Interrupt threads. More...
 
void PrepareShutdown ()
 Preparing steps before shutting down or restarting the wallet. 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...
 
static void HandleSIGTERM (int)
 Signal handlers are very limited in what they are allowed to do. More...
 
static void HandleSIGHUP (int)
 
static void registerSignalHandler (int signal, void(*handler)(int))
 
void OnRPCStarted ()
 
void OnRPCStopped ()
 
std::string GetSupportedSocketEventsStr ()
 
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...
 
static void BlockNotifyCallback (bool initialSync, const CBlockIndex *pBlockIndex)
 
static void BlockNotifyGenesisWait (bool, const CBlockIndex *pBlockIndex)
 
void CleanupBlockRevFiles ()
 
void ThreadImport (std::vector< fs::path > vImportFiles)
 
bool InitSanityCheck (void)
 Sanity checks Ensure that Dash Core is running in a usable environment with all necessary library support. More...
 
bool AppInitServers ()
 
void InitParameterInteraction ()
 Parameter interaction: change current parameters depending on various rules. More...
 
static std::string ResolveErrMsg (const char *const optname, const std::string &strBind)
 
void InitLogging ()
 Initialize the logging infrastructure. More...
 
static void new_handler_terminate ()
 
bool AppInitBasicSetup ()
 Initialize Dash Core: Basic context setup. More...
 
bool AppInitParameterInteraction ()
 Initialization: parameter interaction. More...
 
static bool LockDataDirectory (bool probeOnly)
 
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...
 

Variables

bool fFeeEstimatesInitialized = false
 
static const bool DEFAULT_PROXYRANDOMIZE = true
 
static const bool DEFAULT_REST_ENABLE = false
 
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false
 
std::unique_ptr< CConnmang_connman
 
std::unique_ptr< PeerLogicValidationpeerLogic
 
static DummyWalletInit g_dummy_wallet_init
 
WalletInitInterface *const g_wallet_init_interface = &g_dummy_wallet_init
 
static CDSNotificationInterfacepdsNotificationInterface = nullptr
 
static const char * FEE_ESTIMATES_FILENAME ="fee_estimates.dat"
 
static std::unique_ptr< CCoinsViewErrorCatcherpcoinscatcher
 
static std::unique_ptr< ECCVerifyHandleglobalVerifyHandle
 
static boost::thread_group threadGroup
 
static CScheduler scheduler
 
static bool fHaveGenesis = false
 
static CWaitableCriticalSection cs_GenesisWait
 
static CConditionVariable condvar_GenesisWait
 

Macro Definition Documentation

◆ MIN_CORE_FILEDESCRIPTORS

#define MIN_CORE_FILEDESCRIPTORS   150

Definition at line 137 of file init.cpp.

Referenced by AppInitParameterInteraction().

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().

◆ AppInitServers()

◆ BlockNotifyCallback()

static void BlockNotifyCallback ( bool  initialSync,
const CBlockIndex pBlockIndex 
)
static

◆ BlockNotifyGenesisWait()

static void BlockNotifyGenesisWait ( bool  ,
const CBlockIndex pBlockIndex 
)
static

Definition at line 707 of file init.cpp.

References condvar_GenesisWait, cs_GenesisWait, and fHaveGenesis.

Referenced by AppInitMain().

◆ CleanupBlockRevFiles()

void CleanupBlockRevFiles ( )

Definition at line 738 of file init.cpp.

References atoi(), GetDataDir(), and LogPrintf.

Referenced by AppInitMain().

◆ fDumpMempoolLater()

std::atomic<bool> fDumpMempoolLater ( false  )

Referenced by PrepareShutdown(), and ThreadImport().

◆ fRequestRestart()

std::atomic<bool> fRequestRestart ( false  )

Referenced by Shutdown(), and StartRestart().

◆ fRequestShutdown()

std::atomic<bool> fRequestShutdown ( false  )

◆ GetSupportedSocketEventsStr()

std::string GetSupportedSocketEventsStr ( )

Definition at line 437 of file init.cpp.

Referenced by AppInitMain(), and HelpMessage().

◆ HandleSIGHUP()

static void HandleSIGHUP ( int  )
static

Definition at line 400 of file init.cpp.

References fReopenDebugLog.

Referenced by AppInitBasicSetup().

◆ HandleSIGTERM()

static void HandleSIGTERM ( int  )
static

Signal handlers are very limited in what they are allowed to do.

The execution context the handler is invoked in is not guaranteed, so we restrict handler operations to just touching variables:

Definition at line 395 of file init.cpp.

References fRequestShutdown().

Referenced by AppInitBasicSetup().

◆ 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()

◆ InitSanityCheck()

bool InitSanityCheck ( void  )

Sanity checks Ensure that Dash Core is running in a usable environment with all necessary library support.

Definition at line 883 of file init.cpp.

References BLSInit(), ECC_InitSanityCheck(), glibc_sanity_test(), glibcxx_sanity_test(), InitError(), and Random_SanityCheck().

Referenced by AppInitSanityChecks().

◆ 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().

◆ LockDataDirectory()

static bool LockDataDirectory ( bool  probeOnly)
static

Definition at line 1543 of file init.cpp.

References _(), GetDataDir(), InitError(), LockDirectory(), and strprintf.

Referenced by AppInitLockDataDirectory(), and AppInitSanityChecks().

◆ new_handler_terminate()

static void new_handler_terminate ( )
static

Definition at line 1046 of file init.cpp.

References LogPrintf.

Referenced by AppInitBasicSetup().

◆ OnRPCStarted()

void OnRPCStarted ( )

Definition at line 424 of file init.cpp.

References CClientUIInterface::NotifyBlockTip, RPCNotifyBlockChange(), and uiInterface.

Referenced by AppInitServers().

◆ OnRPCStopped()

void OnRPCStopped ( )

◆ 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().

◆ registerSignalHandler()

static void registerSignalHandler ( int  signal,
void(*)(int)  handler 
)
static

Definition at line 414 of file init.cpp.

References handler.

Referenced by AppInitBasicSetup().

◆ ResolveErrMsg()

static std::string ResolveErrMsg ( const char *const  optname,
const std::string &  strBind 
)
static

Definition at line 1019 of file init.cpp.

References _(), and strprintf.

Referenced by AppInitMain().

◆ 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()

◆ ThreadImport()

Variable Documentation

◆ condvar_GenesisWait

CConditionVariable condvar_GenesisWait
static

Definition at line 705 of file init.cpp.

Referenced by AppInitMain(), and BlockNotifyGenesisWait().

◆ cs_GenesisWait

CWaitableCriticalSection cs_GenesisWait
static

Definition at line 704 of file init.cpp.

Referenced by AppInitMain(), and BlockNotifyGenesisWait().

◆ DEFAULT_PROXYRANDOMIZE

const bool DEFAULT_PROXYRANDOMIZE = true
static

Definition at line 92 of file init.cpp.

Referenced by AppInitMain(), and HelpMessage().

◆ DEFAULT_REST_ENABLE

const bool DEFAULT_REST_ENABLE = false
static

Definition at line 93 of file init.cpp.

Referenced by AppInitServers(), and HelpMessage().

◆ DEFAULT_STOPAFTERBLOCKIMPORT

const bool DEFAULT_STOPAFTERBLOCKIMPORT = false
static

Definition at line 94 of file init.cpp.

Referenced by HelpMessage(), and ThreadImport().

◆ FEE_ESTIMATES_FILENAME

const char* FEE_ESTIMATES_FILENAME ="fee_estimates.dat"
static

Definition at line 140 of file init.cpp.

Referenced by AppInitMain(), and PrepareShutdown().

◆ fFeeEstimatesInitialized

bool fFeeEstimatesInitialized = false

Definition at line 91 of file init.cpp.

Referenced by AppInitMain(), and PrepareShutdown().

◆ fHaveGenesis

bool fHaveGenesis = false
static

Definition at line 703 of file init.cpp.

Referenced by AppInitMain(), and BlockNotifyGenesisWait().

◆ g_connman

std::unique_ptr<CConnman> g_connman

Definition at line 97 of file init.cpp.

Referenced by llmq::CQuorumBlockProcessor::AddMinableCommitment(), addnode(), llmq::CLLMQUtils::AddQuorumProbeConnections(), AppInitMain(), llmq::CInstantSendManager::AskNodesForLockedTx(), RPCConsole::banSelectedNode(), PeerLogicValidation::BlockConnected(), llmq::CSigSharesManager::Cleanup(), clearbanned(), llmq::CSigSharesManager::CollectSigSharesToAnnounce(), CTransactionBuilder::Commit(), disconnectnode(), RPCConsole::disconnectSelectedNode(), llmq::CLLMQUtils::EnsureQuorumConnections(), llmq::CQuorumManager::EnsureQuorumConnections(), getaddednodeinfo(), getblocktemplate(), getconnectioncount(), CActiveMasternodeManager::GetLocalAddress(), getnettotals(), ClientModel::getNetworkActive(), getnetworkinfo(), ClientModel::getNumConnections(), getpeerinfo(), ClientModel::getTotalBytesRecv(), ClientModel::getTotalBytesSent(), gobject_submit(), gobject_vote_conf(), Interrupt(), listbanned(), masternode_connect(), mnsync(), CMNAuth::NotifyMasternodeListChanged(), ping(), PrepareShutdown(), llmq::CInstantSendManager::ProcessInstantSendLock(), llmq::CChainLocksHandler::ProcessNewChainLock(), llmq::CSigningManager::ProcessPendingReconstructedRecoveredSigs(), llmq::CInstantSendManager::ProcessTx(), quorum_dkgstatus(), BanTablePriv::refreshBanlist(), PeerTablePriv::refreshPeers(), llmq::CDKGSession::RelayInvToParticipants(), resendwallettransactions(), WalletModel::sendCoins(), sendmany(), llmq::CSigSharesManager::SendMessages(), SendMoney(), sendrawtransaction(), setban(), ClientModel::setNetworkActive(), setnetworkactive(), llmq::CSigSharesManager::Sign(), spork(), WalletInit::Start(), RPCConsole::unbanSelectedNode(), llmq::CDKGSession::VerifyConnectionAndMinProtoVersions(), voteraw(), VoteWithMasternodes(), and llmq::CSigSharesManager::WorkThreadMain().

◆ g_dummy_wallet_init

DummyWalletInit g_dummy_wallet_init
static

Definition at line 121 of file init.cpp.

◆ g_wallet_init_interface

WalletInitInterface* const g_wallet_init_interface = &g_dummy_wallet_init

◆ globalVerifyHandle

std::unique_ptr<ECCVerifyHandle> globalVerifyHandle
static

Definition at line 210 of file init.cpp.

Referenced by AppInitSanityChecks(), and Shutdown().

◆ pcoinscatcher

std::unique_ptr<CCoinsViewErrorCatcher> pcoinscatcher
static

Definition at line 209 of file init.cpp.

Referenced by AppInitMain(), and PrepareShutdown().

◆ pdsNotificationInterface

CDSNotificationInterface* pdsNotificationInterface = nullptr
static

Definition at line 129 of file init.cpp.

Referenced by AppInitMain(), PrepareShutdown(), and ThreadImport().

◆ peerLogic

std::unique_ptr<PeerLogicValidation> peerLogic

Definition at line 98 of file init.cpp.

Referenced by AppInitMain(), and PrepareShutdown().

◆ scheduler

◆ threadGroup

boost::thread_group threadGroup
static

Definition at line 212 of file init.cpp.

Referenced by AppInitMain(), and PrepareShutdown().

Released under the MIT license