Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
bool fPruneMode = false; | bool fPruneMode = false; | ||||
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG; | bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG; | ||||
bool fRequireStandard = true; | bool fRequireStandard = true; | ||||
bool fCheckBlockIndex = false; | bool fCheckBlockIndex = false; | ||||
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED; | bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED; | ||||
size_t nCoinCacheUsage = 5000 * 300; | size_t nCoinCacheUsage = 5000 * 300; | ||||
uint64_t nPruneTarget = 0; | uint64_t nPruneTarget = 0; | ||||
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; | int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; | ||||
time_t g_IBDCompletionTime = 0; | |||||
uint256 hashAssumeValid; | uint256 hashAssumeValid; | ||||
arith_uint256 nMinimumChainWork; | arith_uint256 nMinimumChainWork; | ||||
Amount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; | Amount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; | ||||
CTxMemPool g_mempool; | CTxMemPool g_mempool; | ||||
▲ Show 20 Lines • Show All 839 Lines • ▼ Show 20 Lines | if (chainActive.Tip() == nullptr) { | ||||
return true; | return true; | ||||
} | } | ||||
if (chainActive.Tip()->nChainWork < nMinimumChainWork) { | if (chainActive.Tip()->nChainWork < nMinimumChainWork) { | ||||
return true; | return true; | ||||
} | } | ||||
if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge)) { | if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge)) { | ||||
return true; | return true; | ||||
} | } | ||||
g_IBDCompletionTime = GetTime(); | |||||
LogPrintf("Leaving InitialBlockDownload (latching to false)\n"); | LogPrintf("Leaving InitialBlockDownload (latching to false)\n"); | ||||
latchToFalse.store(true, std::memory_order_relaxed); | latchToFalse.store(true, std::memory_order_relaxed); | ||||
return false; | return false; | ||||
} | } | ||||
CBlockIndex const *pindexBestForkTip = nullptr; | CBlockIndex const *pindexBestForkTip = nullptr; | ||||
CBlockIndex const *pindexBestForkBase = nullptr; | CBlockIndex const *pindexBestForkBase = nullptr; | ||||
▲ Show 20 Lines • Show All 1,419 Lines • ▼ Show 20 Lines | LogPrint(BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs]\n", | ||||
} | } | ||||
return error("ConnectTip(): ConnectBlock %s failed (%s)", | return error("ConnectTip(): ConnectBlock %s failed (%s)", | ||||
pindexNew->GetBlockHash().ToString(), | pindexNew->GetBlockHash().ToString(), | ||||
FormatStateMessage(state)); | FormatStateMessage(state)); | ||||
} | } | ||||
// Update the finalized block. | // Update the finalized block. | ||||
time_t finalizationDelay = | |||||
gArgs.GetArg("-finalizationdelay", DEFAULT_FINALIZATION_DELAY); | |||||
// Update the finalized block. | |||||
int32_t nHeightToFinalize = | int32_t nHeightToFinalize = | ||||
pindexNew->nHeight - | pindexNew->nHeight - | ||||
gArgs.GetArg("-maxreorgdepth", DEFAULT_MAX_REORG_DEPTH); | gArgs.GetArg("-maxreorgdepth", DEFAULT_MAX_REORG_DEPTH); | ||||
CBlockIndex *pindexToFinalize = | CBlockIndex *pindexToFinalize = | ||||
pindexNew->GetAncestor(nHeightToFinalize); | pindexNew->GetAncestor(nHeightToFinalize); | ||||
if (pindexToFinalize && | if (pindexToFinalize && | ||||
g_IBDCompletionTime + finalizationDelay >= GetTime() && | |||||
!FinalizeBlockInternal(config, state, pindexToFinalize)) { | !FinalizeBlockInternal(config, state, pindexToFinalize)) { | ||||
state.SetCorruptionPossible(); | state.SetCorruptionPossible(); | ||||
return error("ConnectTip(): FinalizeBlock %s failed (%s)", | return error("ConnectTip(): FinalizeBlock %s failed (%s)", | ||||
pindexNew->GetBlockHash().ToString(), | pindexNew->GetBlockHash().ToString(), | ||||
FormatStateMessage(state)); | FormatStateMessage(state)); | ||||
} | } | ||||
nTime3 = GetTimeMicros(); | nTime3 = GetTimeMicros(); | ||||
▲ Show 20 Lines • Show All 3,073 Lines • Show Last 20 Lines |