diff options
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 116 |
1 files changed, 55 insertions, 61 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index bf2b4b315e..ab94ac02eb 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3,7 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <config/bitcoin-config.h> // IWYU pragma: keep +#include <bitcoin-build-config.h> // IWYU pragma: keep #include <validation.h> @@ -70,6 +70,7 @@ #include <numeric> #include <optional> #include <ranges> +#include <span> #include <string> #include <tuple> #include <utility> @@ -107,17 +108,6 @@ const std::vector<std::string> CHECKLEVEL_DOC { * */ static constexpr int PRUNE_LOCK_BUFFER{10}; -/** - * Maximum number of seconds that the timestamp of the first - * block of a difficulty adjustment period is allowed to - * be earlier than the last block of the previous period (BIP94). - */ -static constexpr int64_t MAX_TIMEWARP = 600; - -GlobalMutex g_best_block_mutex; -std::condition_variable g_best_block_cv; -uint256 g_best_block; - const CBlockIndex* Chainstate::FindForkInGlobalIndex(const CBlockLocator& locator) const { AssertLockHeld(cs_main); @@ -276,7 +266,7 @@ static void LimitMempoolSize(CTxMemPool& pool, CCoinsViewCache& coins_cache) AssertLockHeld(pool.cs); int expired = pool.Expire(GetTime<std::chrono::seconds>() - pool.m_opts.expiry); if (expired != 0) { - LogPrint(BCLog::MEMPOOL, "Expired %i transactions from the memory pool\n", expired); + LogDebug(BCLog::MEMPOOL, "Expired %i transactions from the memory pool\n", expired); } std::vector<COutPoint> vNoSpendsRemaining; @@ -1226,7 +1216,7 @@ bool MemPoolAccept::PackageMempoolChecks(const std::vector<CTransactionRef>& txn "package RBF failed: " + err_tup.value().second, ""); } - LogPrint(BCLog::TXPACKAGES, "package RBF checks passed: parent %s (wtxid=%s), child %s (wtxid=%s)\n", + LogDebug(BCLog::TXPACKAGES, "package RBF checks passed: parent %s (wtxid=%s), child %s (wtxid=%s)\n", txns.front()->GetHash().ToString(), txns.front()->GetWitnessHash().ToString(), txns.back()->GetHash().ToString(), txns.back()->GetWitnessHash().ToString()); @@ -1309,7 +1299,7 @@ bool MemPoolAccept::Finalize(const ATMPArgs& args, Workspace& ws) // Remove conflicting transactions from the mempool for (CTxMemPool::txiter it : m_subpackage.m_all_conflicts) { - LogPrint(BCLog::MEMPOOL, "replacing mempool tx %s (wtxid=%s, fees=%s, vsize=%s). New tx %s (wtxid=%s, fees=%s, vsize=%s)\n", + LogDebug(BCLog::MEMPOOL, "replacing mempool tx %s (wtxid=%s, fees=%s, vsize=%s). New tx %s (wtxid=%s, fees=%s, vsize=%s)\n", it->GetTx().GetHash().ToString(), it->GetTx().GetWitnessHash().ToString(), it->GetFee(), @@ -1412,7 +1402,7 @@ bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& [](const auto& ws) { return ws.m_ptx->GetWitnessHash(); }); if (!m_subpackage.m_replaced_transactions.empty()) { - LogPrint(BCLog::MEMPOOL, "replaced %u mempool transactions with %u new one(s) for %s additional fees, %d delta bytes\n", + LogDebug(BCLog::MEMPOOL, "replaced %u mempool transactions with %u new one(s) for %s additional fees, %d delta bytes\n", m_subpackage.m_replaced_transactions.size(), workspaces.size(), m_subpackage.m_total_modified_fees - m_subpackage.m_conflicting_fees, m_subpackage.m_total_vsize - static_cast<int>(m_subpackage.m_conflicting_size)); @@ -1500,7 +1490,7 @@ MempoolAcceptResult MemPoolAccept::AcceptSingleTransaction(const CTransactionRef } if (!m_subpackage.m_replaced_transactions.empty()) { - LogPrint(BCLog::MEMPOOL, "replaced %u mempool transactions with 1 new transaction for %s additional fees, %d delta bytes\n", + LogDebug(BCLog::MEMPOOL, "replaced %u mempool transactions with 1 new transaction for %s additional fees, %d delta bytes\n", m_subpackage.m_replaced_transactions.size(), ws.m_modified_fees - m_subpackage.m_conflicting_fees, ws.m_vsize - static_cast<int>(m_subpackage.m_conflicting_size)); @@ -2030,7 +2020,8 @@ void Chainstate::CheckForkWarningConditions() // Before we get past initial download, we cannot reliably alert about forks // (we assume we don't get stuck on a fork before finishing our initial sync) - if (m_chainman.IsInitialBlockDownload()) { + // Also not applicable to the background chainstate + if (m_chainman.IsInitialBlockDownload() || this->GetRole() == ChainstateRole::BACKGROUND) { return; } @@ -2188,6 +2179,8 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state, if (pvChecks) { pvChecks->emplace_back(std::move(check)); } else if (!check()) { + ScriptError error{check.GetScriptError()}; + if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) { // Check whether the failure was caused by a // non-mandatory script verification check, such as @@ -2201,6 +2194,14 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state, flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, cacheSigStore, &txdata); if (check2()) return state.Invalid(TxValidationResult::TX_NOT_STANDARD, strprintf("non-mandatory-script-verify-flag (%s)", ScriptErrorString(check.GetScriptError()))); + + // If the second check failed, it failed due to a mandatory script verification + // flag, but the first check might have failed on a non-mandatory script + // verification flag. + // + // Avoid reporting a mandatory script check failure with a non-mandatory error + // string by reporting the error from the second check. + error = check2.GetScriptError(); } // MANDATORY flag failures correspond to // TxValidationResult::TX_CONSENSUS. Because CONSENSUS @@ -2211,7 +2212,7 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state, // support, to avoid splitting the network (but this // depends on the details of how net_processing handles // such errors). - return state.Invalid(TxValidationResult::TX_CONSENSUS, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))); + return state.Invalid(TxValidationResult::TX_CONSENSUS, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(error))); } } @@ -2493,7 +2494,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, const auto time_1{SteadyClock::now()}; m_chainman.time_check += time_1 - time_start; - LogPrint(BCLog::BENCH, " - Sanity checks: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Sanity checks: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_1 - time_start), Ticks<SecondsDouble>(m_chainman.time_check), Ticks<MillisecondsDouble>(m_chainman.time_check) / m_chainman.num_blocks_total); @@ -2595,7 +2596,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, const auto time_2{SteadyClock::now()}; m_chainman.time_forks += time_2 - time_1; - LogPrint(BCLog::BENCH, " - Fork checks: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Fork checks: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_2 - time_1), Ticks<SecondsDouble>(m_chainman.time_forks), Ticks<MillisecondsDouble>(m_chainman.time_forks) / m_chainman.num_blocks_total); @@ -2686,7 +2687,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, } const auto time_3{SteadyClock::now()}; m_chainman.time_connect += time_3 - time_2; - LogPrint(BCLog::BENCH, " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs (%.2fms/blk)]\n", (unsigned)block.vtx.size(), + LogDebug(BCLog::BENCH, " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs (%.2fms/blk)]\n", (unsigned)block.vtx.size(), Ticks<MillisecondsDouble>(time_3 - time_2), Ticks<MillisecondsDouble>(time_3 - time_2) / block.vtx.size(), nInputs <= 1 ? 0 : Ticks<MillisecondsDouble>(time_3 - time_2) / (nInputs - 1), Ticks<SecondsDouble>(m_chainman.time_connect), @@ -2704,7 +2705,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, } const auto time_4{SteadyClock::now()}; m_chainman.time_verify += time_4 - time_2; - LogPrint(BCLog::BENCH, " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs (%.2fms/blk)]\n", nInputs - 1, + LogDebug(BCLog::BENCH, " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs (%.2fms/blk)]\n", nInputs - 1, Ticks<MillisecondsDouble>(time_4 - time_2), nInputs <= 1 ? 0 : Ticks<MillisecondsDouble>(time_4 - time_2) / (nInputs - 1), Ticks<SecondsDouble>(m_chainman.time_verify), @@ -2719,7 +2720,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, const auto time_5{SteadyClock::now()}; m_chainman.time_undo += time_5 - time_4; - LogPrint(BCLog::BENCH, " - Write undo data: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Write undo data: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_5 - time_4), Ticks<SecondsDouble>(m_chainman.time_undo), Ticks<MillisecondsDouble>(m_chainman.time_undo) / m_chainman.num_blocks_total); @@ -2734,7 +2735,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, const auto time_6{SteadyClock::now()}; m_chainman.time_index += time_6 - time_5; - LogPrint(BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_6 - time_5), Ticks<SecondsDouble>(m_chainman.time_index), Ticks<MillisecondsDouble>(m_chainman.time_index) / m_chainman.num_blocks_total); @@ -2745,7 +2746,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state, block.vtx.size(), nInputs, nSigOpsCost, - time_5 - time_start // in microseconds (µs) + Ticks<std::chrono::nanoseconds>(time_5 - time_start) ); return true; @@ -2820,7 +2821,7 @@ bool Chainstate::FlushStateToDisk( } if (limiting_lock) { - LogPrint(BCLog::PRUNE, "%s limited pruning to height %d\n", limiting_lock.value(), last_prune); + LogDebug(BCLog::PRUNE, "%s limited pruning to height %d\n", limiting_lock.value(), last_prune); } if (nManualPruneHeight > 0) { @@ -2994,12 +2995,6 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew) m_mempool->AddTransactionsUpdated(1); } - { - LOCK(g_best_block_mutex); - g_best_block = pindexNew->GetBlockHash(); - g_best_block_cv.notify_all(); - } - std::vector<bilingual_str> warning_messages; if (!m_chainman.IsInitialBlockDownload()) { const CBlockIndex* pindex = pindexNew; @@ -3057,7 +3052,7 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra bool flushed = view.Flush(); assert(flushed); } - LogPrint(BCLog::BENCH, "- Disconnect block: %.2fms\n", + LogDebug(BCLog::BENCH, "- Disconnect block: %.2fms\n", Ticks<MillisecondsDouble>(SteadyClock::now() - time_start)); { @@ -3067,7 +3062,7 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra if (prune_lock.second.height_first <= max_height_first) continue; prune_lock.second.height_first = max_height_first; - LogPrint(BCLog::PRUNE, "%s prune lock moved back to %d\n", prune_lock.first, max_height_first); + LogDebug(BCLog::PRUNE, "%s prune lock moved back to %d\n", prune_lock.first, max_height_first); } } @@ -3157,7 +3152,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, } pthisBlock = pblockNew; } else { - LogPrint(BCLog::BENCH, " - Using cached block\n"); + LogDebug(BCLog::BENCH, " - Using cached block\n"); pthisBlock = pblock; } const CBlock& blockConnecting = *pthisBlock; @@ -3166,7 +3161,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, SteadyClock::time_point time_3; // When adding aggregate statistics in the future, keep in mind that // num_blocks_total may be zero until the ConnectBlock() call below. - LogPrint(BCLog::BENCH, " - Load block from disk: %.2fms\n", + LogDebug(BCLog::BENCH, " - Load block from disk: %.2fms\n", Ticks<MillisecondsDouble>(time_2 - time_1)); { CCoinsViewCache view(&CoinsTip()); @@ -3183,7 +3178,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, time_3 = SteadyClock::now(); m_chainman.time_connect_total += time_3 - time_2; assert(m_chainman.num_blocks_total > 0); - LogPrint(BCLog::BENCH, " - Connect total: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Connect total: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_3 - time_2), Ticks<SecondsDouble>(m_chainman.time_connect_total), Ticks<MillisecondsDouble>(m_chainman.time_connect_total) / m_chainman.num_blocks_total); @@ -3192,7 +3187,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, } const auto time_4{SteadyClock::now()}; m_chainman.time_flush += time_4 - time_3; - LogPrint(BCLog::BENCH, " - Flush: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Flush: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_4 - time_3), Ticks<SecondsDouble>(m_chainman.time_flush), Ticks<MillisecondsDouble>(m_chainman.time_flush) / m_chainman.num_blocks_total); @@ -3202,7 +3197,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, } const auto time_5{SteadyClock::now()}; m_chainman.time_chainstate += time_5 - time_4; - LogPrint(BCLog::BENCH, " - Writing chainstate: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Writing chainstate: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_5 - time_4), Ticks<SecondsDouble>(m_chainman.time_chainstate), Ticks<MillisecondsDouble>(m_chainman.time_chainstate) / m_chainman.num_blocks_total); @@ -3218,11 +3213,11 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, const auto time_6{SteadyClock::now()}; m_chainman.time_post_connect += time_6 - time_5; m_chainman.time_total += time_6 - time_1; - LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_6 - time_5), Ticks<SecondsDouble>(m_chainman.time_post_connect), Ticks<MillisecondsDouble>(m_chainman.time_post_connect) / m_chainman.num_blocks_total); - LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs (%.2fms/blk)]\n", + LogDebug(BCLog::BENCH, "- Connect block: %.2fms [%.2fs (%.2fms/blk)]\n", Ticks<MillisecondsDouble>(time_6 - time_1), Ticks<SecondsDouble>(m_chainman.time_total), Ticks<MillisecondsDouble>(m_chainman.time_total) / m_chainman.num_blocks_total); @@ -3548,7 +3543,6 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< m_chainman.m_options.signals->UpdatedBlockTip(pindexNewTip, pindexFork, still_in_ibd); } - // Always notify the UI if a new block tip was connected if (kernel::IsInterrupted(m_chainman.GetNotifications().blockTip(GetSynchronizationState(still_in_ibd, m_chainman.m_blockman.m_blockfiles_indexed), *pindexNewTip))) { // Just breaking and returning success for now. This could // be changed to bubble up the kernel::Interrupted value to @@ -3581,8 +3575,8 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< // // This cannot be done while holding cs_main (within // MaybeCompleteSnapshotValidation) or a cs_main deadlock will occur. - if (m_chainman.restart_indexes) { - m_chainman.restart_indexes(); + if (m_chainman.snapshot_download_completed) { + m_chainman.snapshot_download_completed(); } break; } @@ -4143,7 +4137,7 @@ bool IsBlockMutated(const CBlock& block, bool check_witness_root) return false; } -arith_uint256 CalculateClaimedHeadersWork(const std::vector<CBlockHeader>& headers) +arith_uint256 CalculateClaimedHeadersWork(std::span<const CBlockHeader> headers) { arith_uint256 total_work{0}; for (const CBlockHeader& header : headers) { @@ -4189,7 +4183,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early"); - // Testnet4 only: Check timestamp against prev for difficulty-adjustment + // Testnet4 and regtest only: Check timestamp against prev for difficulty-adjustment // blocks to prevent timewarp attacks (see https://github.com/bitcoin/bitcoin/pull/15482). if (consensusParams.enforce_BIP94) { // Check timestamp for the first block of each difficulty adjustment @@ -4294,14 +4288,14 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida if (ppindex) *ppindex = pindex; if (pindex->nStatus & BLOCK_FAILED_MASK) { - LogPrint(BCLog::VALIDATION, "%s: block %s is marked invalid\n", __func__, hash.ToString()); + LogDebug(BCLog::VALIDATION, "%s: block %s is marked invalid\n", __func__, hash.ToString()); return state.Invalid(BlockValidationResult::BLOCK_CACHED_INVALID, "duplicate"); } return true; } if (!CheckBlockHeader(block, state, GetConsensus())) { - LogPrint(BCLog::VALIDATION, "%s: Consensus::CheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString()); + LogDebug(BCLog::VALIDATION, "%s: Consensus::CheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString()); return false; } @@ -4309,16 +4303,16 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida CBlockIndex* pindexPrev = nullptr; BlockMap::iterator mi{m_blockman.m_block_index.find(block.hashPrevBlock)}; if (mi == m_blockman.m_block_index.end()) { - LogPrint(BCLog::VALIDATION, "header %s has prev block not found: %s\n", hash.ToString(), block.hashPrevBlock.ToString()); + LogDebug(BCLog::VALIDATION, "header %s has prev block not found: %s\n", hash.ToString(), block.hashPrevBlock.ToString()); return state.Invalid(BlockValidationResult::BLOCK_MISSING_PREV, "prev-blk-not-found"); } pindexPrev = &((*mi).second); if (pindexPrev->nStatus & BLOCK_FAILED_MASK) { - LogPrint(BCLog::VALIDATION, "header %s has prev block invalid: %s\n", hash.ToString(), block.hashPrevBlock.ToString()); + LogDebug(BCLog::VALIDATION, "header %s has prev block invalid: %s\n", hash.ToString(), block.hashPrevBlock.ToString()); return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk"); } if (!ContextualCheckBlockHeader(block, state, m_blockman, *this, pindexPrev)) { - LogPrint(BCLog::VALIDATION, "%s: Consensus::ContextualCheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString()); + LogDebug(BCLog::VALIDATION, "%s: Consensus::ContextualCheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString()); return false; } @@ -4355,14 +4349,14 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida m_blockman.m_dirty_blockindex.insert(invalid_walk); invalid_walk = invalid_walk->pprev; } - LogPrint(BCLog::VALIDATION, "header %s has prev block invalid: %s\n", hash.ToString(), block.hashPrevBlock.ToString()); + LogDebug(BCLog::VALIDATION, "header %s has prev block invalid: %s\n", hash.ToString(), block.hashPrevBlock.ToString()); return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk"); } } } } if (!min_pow_checked) { - LogPrint(BCLog::VALIDATION, "%s: not adding new block header %s, missing anti-dos proof-of-work validation\n", __func__, hash.ToString()); + LogDebug(BCLog::VALIDATION, "%s: not adding new block header %s, missing anti-dos proof-of-work validation\n", __func__, hash.ToString()); return state.Invalid(BlockValidationResult::BLOCK_HEADER_LOW_WORK, "too-little-chainwork"); } CBlockIndex* pindex{m_blockman.AddToBlockIndex(block, m_best_header)}; @@ -4391,7 +4385,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida } // Exposed wrapper for AcceptBlockHeader -bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, bool min_pow_checked, BlockValidationState& state, const CBlockIndex** ppindex) +bool ChainstateManager::ProcessNewBlockHeaders(std::span<const CBlockHeader> headers, bool min_pow_checked, BlockValidationState& state, const CBlockIndex** ppindex) { AssertLockNotHeld(cs_main); { @@ -5091,7 +5085,7 @@ void ChainstateManager::LoadExternalBlockFile( LOCK(cs_main); // detect out of order blocks, and store them for later if (hash != params.GetConsensus().hashGenesisBlock && !m_blockman.LookupBlockIndex(header.hashPrevBlock)) { - LogPrint(BCLog::REINDEX, "%s: Out of order block %s, parent %s not known\n", __func__, hash.ToString(), + LogDebug(BCLog::REINDEX, "%s: Out of order block %s, parent %s not known\n", __func__, hash.ToString(), header.hashPrevBlock.ToString()); if (dbp && blocks_with_unknown_parent) { blocks_with_unknown_parent->emplace(header.hashPrevBlock, *dbp); @@ -5116,7 +5110,7 @@ void ChainstateManager::LoadExternalBlockFile( break; } } else if (hash != params.GetConsensus().hashGenesisBlock && pindex->nHeight % 1000 == 0) { - LogPrint(BCLog::REINDEX, "Block Import: already had block %s at height %d\n", hash.ToString(), pindex->nHeight); + LogDebug(BCLog::REINDEX, "Block Import: already had block %s at height %d\n", hash.ToString(), pindex->nHeight); } } @@ -5147,7 +5141,7 @@ void ChainstateManager::LoadExternalBlockFile( for (auto c : GetAll()) { BlockValidationState state; if (!c->ActivateBestChain(state, pblock)) { - LogPrint(BCLog::REINDEX, "failed to activate chain (%s)\n", state.ToString()); + LogDebug(BCLog::REINDEX, "failed to activate chain (%s)\n", state.ToString()); activation_failure = true; break; } @@ -5172,7 +5166,7 @@ void ChainstateManager::LoadExternalBlockFile( std::multimap<uint256, FlatFilePos>::iterator it = range.first; std::shared_ptr<CBlock> pblockrecursive = std::make_shared<CBlock>(); if (m_blockman.ReadBlockFromDisk(*pblockrecursive, it->second)) { - LogPrint(BCLog::REINDEX, "%s: Processing out of order child %s of %s\n", __func__, pblockrecursive->GetHash().ToString(), + LogDebug(BCLog::REINDEX, "%s: Processing out of order child %s of %s\n", __func__, pblockrecursive->GetHash().ToString(), head.ToString()); LOCK(cs_main); BlockValidationState dummy; @@ -5198,7 +5192,7 @@ void ChainstateManager::LoadExternalBlockFile( // the reindex process is not the place to attempt to clean and/or compact the block files. if so desired, a studious node operator // may use knowledge of the fact that the block files are not entirely pristine in order to prepare a set of pristine, and // perhaps ordered, block files for later reindexing. - LogPrint(BCLog::REINDEX, "%s: unexpected data at file offset 0x%x - %s. continuing\n", __func__, (nRewind - 1), e.what()); + LogDebug(BCLog::REINDEX, "%s: unexpected data at file offset 0x%x - %s. continuing\n", __func__, (nRewind - 1), e.what()); } } } catch (const std::runtime_error& e) { @@ -6020,7 +6014,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot( index = snapshot_chainstate.m_chain[i]; // Fake BLOCK_OPT_WITNESS so that Chainstate::NeedsRedownload() - // won't ask to rewind the entire assumed-valid chain on startup. + // won't ask for -reindex on startup. if (DeploymentActiveAt(*index, *this, Consensus::DEPLOYMENT_SEGWIT)) { index->nStatus |= BLOCK_OPT_WITNESS; } |