Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Global state | * Global state | ||||
*/ | */ | ||||
CCriticalSection cs_main; | CCriticalSection cs_main; | ||||
BlockMap mapBlockIndex; | BlockMap mapBlockIndex; | ||||
CChain chainActive; | CChain chainActive; | ||||
CBlockIndex *pindexBestHeader = nullptr; | CBlockIndex *pindexBestHeader = nullptr; | ||||
CWaitableCriticalSection csBestBlock; | CWaitableCriticalSection g_best_block_mutex; | ||||
CConditionVariable cvBlockChange; | CConditionVariable g_best_block_cv; | ||||
uint256 g_best_block; | |||||
int nScriptCheckThreads = 0; | int nScriptCheckThreads = 0; | ||||
std::atomic_bool fImporting(false); | std::atomic_bool fImporting(false); | ||||
bool fReindex = false; | bool fReindex = false; | ||||
bool fTxIndex = false; | bool fTxIndex = false; | ||||
bool fHavePruned = false; | bool fHavePruned = false; | ||||
bool fPruneMode = false; | bool fPruneMode = false; | ||||
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG; | bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG; | ||||
bool fRequireStandard = true; | bool fRequireStandard = true; | ||||
▲ Show 20 Lines • Show All 1,979 Lines • ▼ Show 20 Lines | static void UpdateTip(const Config &config, CBlockIndex *pindexNew) { | ||||
const Consensus::Params &consensusParams = | const Consensus::Params &consensusParams = | ||||
config.GetChainParams().GetConsensus(); | config.GetChainParams().GetConsensus(); | ||||
chainActive.SetTip(pindexNew); | chainActive.SetTip(pindexNew); | ||||
// New best block | // New best block | ||||
mempool.AddTransactionsUpdated(1); | mempool.AddTransactionsUpdated(1); | ||||
cvBlockChange.notify_all(); | { | ||||
WaitableLock lock(g_best_block_mutex); | |||||
g_best_block = pindexNew->GetBlockHash(); | |||||
g_best_block_cv.notify_all(); | |||||
} | |||||
static bool fWarned = false; | static bool fWarned = false; | ||||
std::vector<std::string> warningMessages; | std::vector<std::string> warningMessages; | ||||
if (!IsInitialBlockDownload()) { | if (!IsInitialBlockDownload()) { | ||||
int nUpgraded = 0; | int nUpgraded = 0; | ||||
const CBlockIndex *pindex = chainActive.Tip(); | const CBlockIndex *pindex = chainActive.Tip(); | ||||
// Check the version of the last 100 blocks to see if we need to | // Check the version of the last 100 blocks to see if we need to | ||||
▲ Show 20 Lines • Show All 3,068 Lines • Show Last 20 Lines |