Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
| Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
| #if ENABLE_ZMQ | #if ENABLE_ZMQ | ||||
| #include "zmq/zmqnotificationinterface.h" | #include "zmq/zmqnotificationinterface.h" | ||||
| #endif | #endif | ||||
| bool fFeeEstimatesInitialized = false; | bool fFeeEstimatesInitialized = false; | ||||
| static const bool DEFAULT_PROXYRANDOMIZE = true; | static const bool DEFAULT_PROXYRANDOMIZE = true; | ||||
| static const bool DEFAULT_REST_ENABLE = false; | static const bool DEFAULT_REST_ENABLE = false; | ||||
| static const bool DEFAULT_DISABLE_SAFEMODE = false; | static const bool DEFAULT_DISABLE_SAFEMODE = false; | ||||
| static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false; | |||||
| std::unique_ptr<CConnman> g_connman; | std::unique_ptr<CConnman> g_connman; | ||||
| std::unique_ptr<PeerLogicValidation> peerLogic; | std::unique_ptr<PeerLogicValidation> peerLogic; | ||||
| #if ENABLE_ZMQ | #if ENABLE_ZMQ | ||||
| static CZMQNotificationInterface *pzmqNotificationInterface = nullptr; | static CZMQNotificationInterface *pzmqNotificationInterface = nullptr; | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| MapPort(false); | MapPort(false); | ||||
| UnregisterValidationInterface(peerLogic.get()); | UnregisterValidationInterface(peerLogic.get()); | ||||
| peerLogic.reset(); | peerLogic.reset(); | ||||
| g_connman.reset(); | g_connman.reset(); | ||||
| StopTorControl(); | StopTorControl(); | ||||
| UnregisterNodeSignals(GetNodeSignals()); | UnregisterNodeSignals(GetNodeSignals()); | ||||
| if (fDumpMempoolLater && | if (fDumpMempoolLater && gArgs.IsPersistMempoolSet()) { | ||||
| gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | |||||
| DumpMempool(); | DumpMempool(); | ||||
| } | } | ||||
| if (fFeeEstimatesInitialized) { | if (fFeeEstimatesInitialized) { | ||||
| fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; | fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; | ||||
| CAutoFile est_fileout(fsbridge::fopen(est_path, "wb"), SER_DISK, | CAutoFile est_fileout(fsbridge::fopen(est_path, "wb"), SER_DISK, | ||||
| CLIENT_VERSION); | CLIENT_VERSION); | ||||
| if (!est_fileout.IsNull()) | if (!est_fileout.IsNull()) | ||||
| ▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | if (showDebug) { | ||||
| strUsage += HelpMessageOpt( | strUsage += HelpMessageOpt( | ||||
| "-minimumchainwork=<hex>", | "-minimumchainwork=<hex>", | ||||
| strprintf( | strprintf( | ||||
| "Minimum work assumed to exist on a valid chain in hex " | "Minimum work assumed to exist on a valid chain in hex " | ||||
| "(default: %s, testnet: %s)", | "(default: %s, testnet: %s)", | ||||
| defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), | defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), | ||||
| testnetChainParams->GetConsensus().nMinimumChainWork.GetHex())); | testnetChainParams->GetConsensus().nMinimumChainWork.GetHex())); | ||||
| } | } | ||||
| strUsage += | strUsage += gArgs.PersistMempoolHelp(); | ||||
| HelpMessageOpt("-persistmempool", | |||||
| strprintf(_("Whether to save the mempool on shutdown " | |||||
| "and load on restart (default: %u)"), | |||||
| DEFAULT_PERSIST_MEMPOOL)); | |||||
| strUsage += HelpMessageOpt( | strUsage += HelpMessageOpt( | ||||
| "-blockreconstructionextratxn=<n>", | "-blockreconstructionextratxn=<n>", | ||||
| strprintf(_("Extra transactions to keep in memory for compact block " | strprintf(_("Extra transactions to keep in memory for compact block " | ||||
| "reconstructions (default: %u)"), | "reconstructions (default: %u)"), | ||||
| DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN)); | DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN)); | ||||
| strUsage += HelpMessageOpt( | strUsage += HelpMessageOpt( | ||||
| "-par=<n>", | "-par=<n>", | ||||
| strprintf(_("Set the number of script verification threads (%u to %d, " | strprintf(_("Set the number of script verification threads (%u to %d, " | ||||
| ▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | if (showDebug) { | ||||
| "-testsafemode", | "-testsafemode", | ||||
| strprintf("Force safe mode (default: %d)", DEFAULT_TESTSAFEMODE)); | strprintf("Force safe mode (default: %d)", DEFAULT_TESTSAFEMODE)); | ||||
| strUsage += | strUsage += | ||||
| HelpMessageOpt("-dropmessagestest=<n>", | HelpMessageOpt("-dropmessagestest=<n>", | ||||
| "Randomly drop 1 of every <n> network messages"); | "Randomly drop 1 of every <n> network messages"); | ||||
| strUsage += | strUsage += | ||||
| HelpMessageOpt("-fuzzmessagestest=<n>", | HelpMessageOpt("-fuzzmessagestest=<n>", | ||||
| "Randomly fuzz 1 of every <n> network messages"); | "Randomly fuzz 1 of every <n> network messages"); | ||||
| strUsage += HelpMessageOpt( | strUsage += gArgs.StopAfterBlockImportHelp(); | ||||
| "-stopafterblockimport", | |||||
| strprintf( | |||||
| "Stop running after importing blocks from disk (default: %d)", | |||||
| DEFAULT_STOPAFTERBLOCKIMPORT)); | |||||
| strUsage += HelpMessageOpt( | strUsage += HelpMessageOpt( | ||||
| "-stopatheight", strprintf("Stop running after reaching the given " | "-stopatheight", strprintf("Stop running after reaching the given " | ||||
| "height in the main chain (default: %u)", | "height in the main chain (default: %u)", | ||||
| DEFAULT_STOPATHEIGHT)); | DEFAULT_STOPATHEIGHT)); | ||||
| strUsage += HelpMessageOpt( | strUsage += HelpMessageOpt( | ||||
| "-limitancestorcount=<n>", | "-limitancestorcount=<n>", | ||||
| strprintf("Do not accept transactions if number of in-mempool " | strprintf("Do not accept transactions if number of in-mempool " | ||||
| "ancestors is <n> or more (default: %u)", | "ancestors is <n> or more (default: %u)", | ||||
| ▲ Show 20 Lines • Show All 396 Lines • ▼ Show 20 Lines | RenameThread("bitcoin-loadblk"); | ||||
| // scan for better chains in the block chain database, that are not yet | // scan for better chains in the block chain database, that are not yet | ||||
| // connected in the active best chain | // connected in the active best chain | ||||
| CValidationState state; | CValidationState state; | ||||
| if (!ActivateBestChain(config, state)) { | if (!ActivateBestChain(config, state)) { | ||||
| LogPrintf("Failed to connect best block"); | LogPrintf("Failed to connect best block"); | ||||
| StartShutdown(); | StartShutdown(); | ||||
| } | } | ||||
| if (gArgs.GetBoolArg("-stopafterblockimport", | if (gArgs.IsStopAfterBlockImportSet()) { | ||||
| DEFAULT_STOPAFTERBLOCKIMPORT)) { | |||||
| LogPrintf("Stopping after block import\n"); | LogPrintf("Stopping after block import\n"); | ||||
| StartShutdown(); | StartShutdown(); | ||||
| } | } | ||||
| } // End scope of CImportingNow | } // End scope of CImportingNow | ||||
| if (gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | if (gArgs.IsPersistMempoolSet()) { | ||||
| LoadMempool(config); | LoadMempool(config); | ||||
| fDumpMempoolLater = !fRequestShutdown; | fDumpMempoolLater = !fRequestShutdown; | ||||
| } | } | ||||
| } | } | ||||
| /** Sanity checks | /** Sanity checks | ||||
| * Ensure that Bitcoin is running in a usable environment with all | * Ensure that Bitcoin is running in a usable environment with all | ||||
| * necessary library support. | * necessary library support. | ||||
| ▲ Show 20 Lines • Show All 1,206 Lines • Show Last 20 Lines | |||||