Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,050 Lines • ▼ Show 20 Lines | static void InvalidChainFound(CBlockIndex *pindexNew) { | ||||
} | } | ||||
// If the invalid chain found is supposed to be finalized, we need to move | // If the invalid chain found is supposed to be finalized, we need to move | ||||
// back the finalization point. | // back the finalization point. | ||||
if (IsBlockFinalized(pindexNew)) { | if (IsBlockFinalized(pindexNew)) { | ||||
pindexFinalized = pindexNew->pprev; | pindexFinalized = pindexNew->pprev; | ||||
} | } | ||||
LogPrintf( | LogPrintf("%s: invalid block=%s height=%d log2_work=%.8g date=%s\n", | ||||
"%s: invalid block=%s height=%d log2_work=%.8g date=%s\n", __func__, | __func__, pindexNew->GetBlockHash().ToString(), | ||||
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, | pindexNew->nHeight, | ||||
log(pindexNew->nChainWork.getdouble()) / log(2.0), | log(pindexNew->nChainWork.getdouble()) / log(2.0), | ||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexNew->GetBlockTime())); | FormatISO8601DateTime(pindexNew->GetBlockTime())); | ||||
CBlockIndex *tip = chainActive.Tip(); | CBlockIndex *tip = chainActive.Tip(); | ||||
assert(tip); | assert(tip); | ||||
LogPrintf("%s: current best=%s height=%d log2_work=%.8g date=%s\n", | LogPrintf("%s: current best=%s height=%d log2_work=%.8g date=%s\n", | ||||
__func__, tip->GetBlockHash().ToString(), chainActive.Height(), | __func__, tip->GetBlockHash().ToString(), chainActive.Height(), | ||||
log(tip->nChainWork.getdouble()) / log(2.0), | log(tip->nChainWork.getdouble()) / log(2.0), | ||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", tip->GetBlockTime())); | FormatISO8601DateTime(tip->GetBlockTime())); | ||||
} | } | ||||
static void InvalidBlockFound(CBlockIndex *pindex, | static void InvalidBlockFound(CBlockIndex *pindex, | ||||
const CValidationState &state) { | const CValidationState &state) { | ||||
if (!state.CorruptionPossible()) { | if (!state.CorruptionPossible()) { | ||||
pindex->nStatus = pindex->nStatus.withFailed(); | pindex->nStatus = pindex->nStatus.withFailed(); | ||||
setDirtyBlockIndex.insert(pindex); | setDirtyBlockIndex.insert(pindex); | ||||
InvalidChainFound(pindex); | InvalidChainFound(pindex); | ||||
▲ Show 20 Lines • Show All 1,064 Lines • ▼ Show 20 Lines | if (!IsInitialBlockDownload()) { | ||||
} | } | ||||
} | } | ||||
LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu " | LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu " | ||||
"date='%s' progress=%f cache=%.1fMiB(%utxo)", | "date='%s' progress=%f cache=%.1fMiB(%utxo)", | ||||
__func__, chainActive.Tip()->GetBlockHash().ToString(), | __func__, chainActive.Tip()->GetBlockHash().ToString(), | ||||
chainActive.Height(), chainActive.Tip()->nVersion, | chainActive.Height(), chainActive.Tip()->nVersion, | ||||
log(chainActive.Tip()->nChainWork.getdouble()) / log(2.0), | log(chainActive.Tip()->nChainWork.getdouble()) / log(2.0), | ||||
(unsigned long)chainActive.Tip()->nChainTx, | (unsigned long)chainActive.Tip()->nChainTx, | ||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", | FormatISO8601DateTime(chainActive.Tip()->GetBlockTime()), | ||||
chainActive.Tip()->GetBlockTime()), | |||||
GuessVerificationProgress(config.GetChainParams().TxData(), | GuessVerificationProgress(config.GetChainParams().TxData(), | ||||
chainActive.Tip()), | chainActive.Tip()), | ||||
pcoinsTip->DynamicMemoryUsage() * (1.0 / (1 << 20)), | pcoinsTip->DynamicMemoryUsage() * (1.0 / (1 << 20)), | ||||
pcoinsTip->GetCacheSize()); | pcoinsTip->GetCacheSize()); | ||||
if (!warningMessages.empty()) { | if (!warningMessages.empty()) { | ||||
LogPrintf(" warning='%s'", | LogPrintf(" warning='%s'", | ||||
boost::algorithm::join(warningMessages, ", ")); | boost::algorithm::join(warningMessages, ", ")); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,267 Lines • ▼ Show 20 Lines | bool LoadChainTip(const Config &config) { | ||||
chainActive.SetTip(it->second); | chainActive.SetTip(it->second); | ||||
PruneBlockIndexCandidates(); | PruneBlockIndexCandidates(); | ||||
LogPrintf( | LogPrintf( | ||||
"Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n", | "Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n", | ||||
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), | chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), | ||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", | FormatISO8601DateTime(chainActive.Tip()->GetBlockTime()), | ||||
chainActive.Tip()->GetBlockTime()), | |||||
GuessVerificationProgress(config.GetChainParams().TxData(), | GuessVerificationProgress(config.GetChainParams().TxData(), | ||||
chainActive.Tip())); | chainActive.Tip())); | ||||
return true; | return true; | ||||
} | } | ||||
CVerifyDB::CVerifyDB() { | CVerifyDB::CVerifyDB() { | ||||
uiInterface.ShowProgress(_("Verifying blocks..."), 0); | uiInterface.ShowProgress(_("Verifying blocks..."), 0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 914 Lines • ▼ Show 20 Lines | static void CheckBlockIndex(const Consensus::Params &consensusParams) { | ||||
// Check that we actually traversed the entire map. | // Check that we actually traversed the entire map. | ||||
assert(nNodes == forward.size()); | assert(nNodes == forward.size()); | ||||
} | } | ||||
std::string CBlockFileInfo::ToString() const { | std::string CBlockFileInfo::ToString() const { | ||||
return strprintf( | return strprintf( | ||||
"CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", | "CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", | ||||
nBlocks, nSize, nHeightFirst, nHeightLast, | nBlocks, nSize, nHeightFirst, nHeightLast, | ||||
DateTimeStrFormat("%Y-%m-%d", nTimeFirst), | FormatISO8601DateTime(nTimeFirst), FormatISO8601DateTime(nTimeLast)); | ||||
DateTimeStrFormat("%Y-%m-%d", nTimeLast)); | |||||
} | } | ||||
CBlockFileInfo *GetBlockFileInfo(size_t n) { | CBlockFileInfo *GetBlockFileInfo(size_t n) { | ||||
return &vinfoBlockFile.at(n); | return &vinfoBlockFile.at(n); | ||||
} | } | ||||
static const uint64_t MEMPOOL_DUMP_VERSION = 1; | static const uint64_t MEMPOOL_DUMP_VERSION = 1; | ||||
▲ Show 20 Lines • Show All 158 Lines • Show Last 20 Lines |