mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
validation: fetch block inputs in parallel
This commit is contained in:
parent
e8c038c9f6
commit
b2da764446
2 changed files with 6 additions and 0 deletions
|
@ -3195,6 +3195,8 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
|
|||
LogDebug(BCLog::BENCH, " - Load block from disk: %.2fms\n",
|
||||
Ticks<MillisecondsDouble>(time_2 - time_1));
|
||||
{
|
||||
m_chainman.GetInputFetcher().FetchInputs(CoinsTip(), CoinsDB(), blockConnecting);
|
||||
|
||||
CCoinsViewCache view(&CoinsTip());
|
||||
bool rv = ConnectBlock(blockConnecting, state, pindexNew, view);
|
||||
if (m_chainman.m_options.signals) {
|
||||
|
@ -6295,6 +6297,7 @@ static ChainstateManager::Options&& Flatten(ChainstateManager::Options&& opts)
|
|||
|
||||
ChainstateManager::ChainstateManager(const util::SignalInterrupt& interrupt, Options options, node::BlockManager::Options blockman_options)
|
||||
: m_script_check_queue{/*batch_size=*/128, std::clamp(options.worker_threads_num, 0, MAX_SCRIPTCHECK_THREADS)},
|
||||
m_input_fetcher{/*batch_size=*/128, std::clamp(options.worker_threads_num, 0, MAX_SCRIPTCHECK_THREADS)},
|
||||
m_interrupt{interrupt},
|
||||
m_options{Flatten(std::move(options))},
|
||||
m_blockman{interrupt, std::move(blockman_options)},
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <consensus/amount.h>
|
||||
#include <cuckoocache.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <inputfetcher.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <kernel/chainparams.h>
|
||||
#include <kernel/chainstatemanager_opts.h>
|
||||
|
@ -951,6 +952,7 @@ private:
|
|||
|
||||
//! A queue for script verifications that have to be performed by worker threads.
|
||||
CCheckQueue<CScriptCheck> m_script_check_queue;
|
||||
InputFetcher m_input_fetcher;
|
||||
|
||||
//! Timers and counters used for benchmarking validation in both background
|
||||
//! and active chainstates.
|
||||
|
@ -1323,6 +1325,7 @@ public:
|
|||
void RecalculateBestHeader() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
CCheckQueue<CScriptCheck>& GetCheckQueue() { return m_script_check_queue; }
|
||||
InputFetcher& GetInputFetcher() { return m_input_fetcher; }
|
||||
|
||||
~ChainstateManager();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue