Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Enumerations | Functions | Variables
init.cpp File Reference
#include "init.h"
#include "addrman.h"
#include "checkpoints.h"
#include "key.h"
#include "main.h"
#include "miner.h"
#include "net.h"
#include "rpcserver.h"
#include "txdb.h"
#include "ui_interface.h"
#include "util.h"
#include <stdint.h>
#include <stdio.h>
#include <signal.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <openssl/crypto.h>
+ Include dependency graph for init.cpp:

Go to the source code of this file.

Classes

struct  CImportingNow
 

Macros

#define MIN_CORE_FILEDESCRIPTORS   150
 

Enumerations

enum  BindFlags {
  BF_NONE = 0,
  BF_EXPLICIT = (1U << 0),
  BF_REPORT_ERROR = (1U << 1)
}
 

Functions

int mastercore_init (void)
 
int mastercore_shutdown (void)
 
void StartShutdown ()
 
bool ShutdownRequested ()
 
void Shutdown ()
 
void HandleSIGTERM (int)
 
void HandleSIGHUP (int)
 
static bool InitError (const std::string &str)
 
static bool InitWarning (const std::string &str)
 
static bool Bind (const CService &addr, unsigned int flags)
 
std::string HelpMessage (HelpMessageMode hmm)
 
void ThreadImport (std::vector< boost::filesystem::path > vImportFiles)
 
bool InitSanityCheck (void)
 Sanity checks Ensure that Bitcoin is running in a usable environment with all necessary library support. More...
 
bool AppInit2 (boost::thread_group &threadGroup)
 Initialize bitcoin. More...
 

Variables

volatile bool fRequestShutdown = false
 
static CCoinsViewDBpcoinsdbview
 

Macro Definition Documentation

#define MIN_CORE_FILEDESCRIPTORS   150

Definition at line 54 of file init.cpp.

Referenced by AppInit2().

Enumeration Type Documentation

enum BindFlags
Enumerator
BF_NONE 
BF_EXPLICIT 
BF_REPORT_ERROR 

Definition at line 58 of file init.cpp.

Function Documentation

bool AppInit2 ( boost::thread_group &  threadGroup)

Initialize bitcoin.

Precondition
Parameters should be parsed and config file should be read.

Definition at line 416 of file init.cpp.

References _(), ActivateBestChain(), AddLocal(), AddOneShot(), addrman, BF_EXPLICIT, BF_NONE, BF_REPORT_ERROR, Bind(), bitdb, bSpendZeroConfChange, CClientUIInterface::BTN_ABORT, CBlock::BuildMerkleTree(), chainActive, CheckDiskSpace(), CLIENT_DATE, CLIENT_VERSION, DateTimeStrFormat(), DB_CORRUPT, DB_LOAD_OK, DB_NEED_REWRITE, DB_NONCRITICAL_ERROR, DB_TOO_NEW, DEFAULT_SCRIPTCHECK_THREADS, error(), fBenchmark, fDebug, fDiscover, FEATURE_LATEST, Checkpoints::fEnabled, CChain::FindFork(), fLogTimestamps, fNameLookup, fNoListen, FormatFullVersion(), fPrintToConsole, fReindex, fRequestShutdown, fServer, fTxIndex, GenerateBitcoins(), CChain::Genesis(), GetArg(), GetBoolArg(), GetDataDir(), GetDefaultDataDir(), CPubKey::GetID(), CWallet::GetKeyFromPool(), GetListenPort(), CChain::GetLocator(), GetNodeSignals(), GetTime(), GetTimeMillis(), HandleSIGHUP(), HandleSIGTERM(), CChain::Height(), InitBlockIndex(), InitError(), CClientUIInterface::InitMessage, InitRPCMining(), InitSanityCheck(), InitWarning(), IsLimited(), CNetAddr::IsValid(), LoadBlockIndex(), CWallet::LoadWallet(), LOCAL_MANUAL, LogPrintf, Lookup(), CWallet::mapAddressBook, mapArgs, mapBlockIndex, mapMultiArgs, CWallet::mapWallet, mastercore_init(), MAX_SCRIPTCHECK_THREADS, mempool, MIN_CORE_FILEDESCRIPTORS, CClientUIInterface::MSG_ERROR, nCoinCacheSize, nConnectTimeout, nDefaultDbCache, NET_IPV4, NET_IPV6, NET_MAX, NET_TOR, NET_UNROUTABLE, CBlockIndex::nHeight, nHighTransactionFeeWarning, nMaxConnections, nMaxDbCache, nMinDbCache, CTransaction::nMinRelayTxFee, CTransaction::nMinTxFee, nScriptCheckThreads, nTransactionFee, nWalletDBUpdated, CDBEnv::Open(), ParseMoney(), ParseNetwork(), pblocktree, pcoinsdbview, pcoinsTip, CBlock::print(), PrintBlockTree(), pwalletMain, RaiseFileDescriptorLimit(), RandAddSeedPerfmon(), CWallet::ReacceptWalletTransactions(), CAddrDB::Read(), CWalletDB::ReadBestBlock(), ReadBlockFromDisk(), CWalletDB::Recover(), CDBEnv::RECOVER_FAIL, CDBEnv::RECOVER_OK, RegisterNodeSignals(), RegisterWallet(), RegTest(), CWallet::ScanForWalletTransactions(), CWallet::SetAddressBook(), CWallet::SetBestChain(), CWallet::SetDefaultKey(), CWallet::setKeyPool, SetLimited(), CWallet::SetMaxVersion(), CWallet::SetMinVersion(), SetNameProxy(), SetProxy(), SetReachable(), CTxMemPool::setSanityCheck(), ShrinkDebugFile(), CAddrMan::size(), SoftSetBoolArg(), source, StartNode(), StartRPCThreads(), strprintf, strWalletFile, CWallet::strWalletFile, ThreadFlushWalletDB(), ThreadImport(), CClientUIInterface::ThreadSafeMessageBox, ThreadScriptCheck(), CChain::Tip(), base_uint< BITS >::ToString(), uiInterface, UnloadBlockIndex(), CWallet::vchDefaultKey, CDBEnv::Verify(), VerifyDB(), CBlockTreeDB::WriteReindexing(), and CWallet::ZapWalletTx().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool Bind ( const CService addr,
unsigned int  flags 
)
static

Definition at line 181 of file init.cpp.

References BF_EXPLICIT, BF_REPORT_ERROR, BindListenPort(), InitError(), and IsLimited().

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HandleSIGHUP ( int  )

Definition at line 164 of file init.cpp.

References fReopenDebugLog.

Referenced by AppInit2().

+ Here is the caller graph for this function:

void HandleSIGTERM ( int  )

Definition at line 159 of file init.cpp.

Referenced by AppInit2().

+ Here is the caller graph for this function:

std::string HelpMessage ( HelpMessageMode  hmm)

Definition at line 194 of file init.cpp.

References _(), DEFAULT_BLOCK_MAX_SIZE, DEFAULT_BLOCK_PRIORITY_SIZE, DEFAULT_MAX_ORPHAN_BLOCKS, DEFAULT_MAX_ORPHAN_TRANSACTIONS, DEFAULT_SCRIPTCHECK_THREADS, FormatMoney(), GetBoolArg(), HMM_BITCOIN_QT, HMM_BITCOIND, MAX_SCRIPTCHECK_THREADS, nDefaultDbCache, nMaxDbCache, nMinDbCache, CTransaction::nMinRelayTxFee, CTransaction::nMinTxFee, and strprintf.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool InitError ( const std::string &  str)
static

Definition at line 169 of file init.cpp.

References CClientUIInterface::MSG_ERROR, CClientUIInterface::NOSHOWGUI, CClientUIInterface::ThreadSafeMessageBox, and uiInterface.

Referenced by AppInit2(), Bind(), and InitSanityCheck().

+ Here is the caller graph for this function:

bool InitSanityCheck ( void  )

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

Definition at line 400 of file init.cpp.

References ECC_InitSanityCheck(), and InitError().

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool InitWarning ( const std::string &  str)
static

Definition at line 175 of file init.cpp.

References CClientUIInterface::MSG_WARNING, CClientUIInterface::NOSHOWGUI, CClientUIInterface::ThreadSafeMessageBox, and uiInterface.

Referenced by AppInit2().

+ Here is the caller graph for this function:

int mastercore_init ( void  )

Definition at line 2405 of file mastercore.cpp.

Referenced by AppInit2().

+ Here is the caller graph for this function:

int mastercore_shutdown ( void  )

Definition at line 2540 of file mastercore.cpp.

References mastercore::_my_sps, DateTimeStrFormat(), GetTime(), mastercore::p_txlistdb, mastercore::s_stolistdb, and mastercore::t_tradelistdb.

Referenced by Shutdown().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Shutdown ( )

Definition at line 110 of file init.cpp.

References CTxMemPool::AddTransactionsUpdated(), bitdb, chainActive, cs_main, CDBEnv::Flush(), CLevelDBWrapper::Flush(), CCoinsViewCache::Flush(), GenerateBitcoins(), CChain::GetLocator(), GetNodeSignals(), GetPidFile(), LOCK, LogPrintf, mastercore_shutdown(), mempool, pblocktree, pcoinsdbview, pcoinsTip, pwalletMain, RenameThread(), CWallet::SetBestChain(), ShutdownRPCMining(), StopNode(), StopRPCThreads(), TRY_LOCK, UnregisterAllWallets(), and UnregisterNodeSignals().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ShutdownRequested ( )

Definition at line 103 of file init.cpp.

References fRequestShutdown.

Referenced by BitcoinGUI::detectShutdown(), DetectShutdownThread(), and ServiceConnection().

+ Here is the caller graph for this function:

void StartShutdown ( )

Definition at line 99 of file init.cpp.

Referenced by AbortNode(), mastercore::checkExpiredAlerts(), encryptwallet(), StartRPCThreads(), and stop().

+ Here is the caller graph for this function:

void ThreadImport ( std::vector< boost::filesystem::path >  vImportFiles)

Definition at line 344 of file init.cpp.

References fReindex, GetDataDir(), InitBlockIndex(), LoadExternalBlockFile(), LogPrintf, OpenBlockFile(), pblocktree, RenameOver(), RenameThread(), and CBlockTreeDB::WriteReindexing().

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

volatile bool fRequestShutdown = false

Definition at line 97 of file init.cpp.

Referenced by AppInit2(), and ShutdownRequested().

CCoinsViewDB* pcoinsdbview
static

Definition at line 108 of file init.cpp.

Referenced by AppInit2(), and Shutdown().