mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
6fb74ead60
dba485d
init: Factor out AppInitLockDataDirectory (Wladimir J. van der Laan)
Pull request description:
Alternative to #10818, alternative solution to #10815.
After this change: All the AppInit steps before and inclusive AppInitLockDataDirectory must not have Shutdown() called in case of failure. Only when AppInitMain fails, Shutdown should be called.
Changes the GUI and bitcoind code to consistently do this.
Tree-SHA512: 393e1a0ae05eb8e791025069e3ac4f6f3cdeb459ec63feda85d01cf6696ab3fed7632b6a0ac3641b8c7015af51d46756b5bba77f5e5f0c446f0c2dea58bbc92e
73 lines
2.5 KiB
C++
73 lines
2.5 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_INIT_H
|
|
#define BITCOIN_INIT_H
|
|
|
|
#include <string>
|
|
|
|
class CScheduler;
|
|
class CWallet;
|
|
|
|
namespace boost
|
|
{
|
|
class thread_group;
|
|
} // namespace boost
|
|
|
|
void StartShutdown();
|
|
void StartRestart();
|
|
bool ShutdownRequested();
|
|
/** Interrupt threads */
|
|
void Interrupt(boost::thread_group& threadGroup);
|
|
void Shutdown();
|
|
//!Initialize the logging infrastructure
|
|
void InitLogging();
|
|
//!Parameter interaction: change current parameters depending on various rules
|
|
void InitParameterInteraction();
|
|
|
|
/** Initialize bitcoin core: Basic context setup.
|
|
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.
|
|
* @pre Parameters should be parsed and config file should be read.
|
|
*/
|
|
bool AppInitBasicSetup();
|
|
/**
|
|
* Initialization: parameter interaction.
|
|
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.
|
|
* @pre Parameters should be parsed and config file should be read, AppInitBasicSetup should have been called.
|
|
*/
|
|
bool AppInitParameterInteraction();
|
|
/**
|
|
* Initialization sanity checks: ecc init, sanity checks, dir lock.
|
|
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.
|
|
* @pre Parameters should be parsed and config file should be read, AppInitParameterInteraction should have been called.
|
|
*/
|
|
bool AppInitSanityChecks();
|
|
/**
|
|
* Lock bitcoin core data directory.
|
|
* @note This should only be done after daemonization. Do not call Shutdown() if this function fails.
|
|
* @pre Parameters should be parsed and config file should be read, AppInitSanityChecks should have been called.
|
|
*/
|
|
bool AppInitLockDataDirectory();
|
|
/**
|
|
* Bitcoin core main initialization.
|
|
* @note This should only be done after daemonization. Call Shutdown() if this function fails.
|
|
* @pre Parameters should be parsed and config file should be read, AppInitLockDataDirectory should have been called.
|
|
*/
|
|
bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler);
|
|
void PrepareShutdown();
|
|
|
|
/** The help message mode determines what help message to show */
|
|
enum HelpMessageMode {
|
|
HMM_BITCOIND,
|
|
HMM_BITCOIN_QT
|
|
};
|
|
|
|
/** Help for options shared between UI and daemon (for -help) */
|
|
std::string HelpMessage(HelpMessageMode mode);
|
|
/** Returns licensing information (for -version) */
|
|
std::string LicenseInfo();
|
|
|
|
#endif // BITCOIN_INIT_H
|