mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-10 23:58:17 +02:00
Merge bitcoin/bitcoin#34054: net processing: Add ibd check before processing block for txdownloadman
e5f0613503net processing: Check if we are in ibd before processing block for txdownloadman (sedited)ce8b692897Add functional test exercising tx downloadman recently confirmed filter (Lőrinc) Pull request description: Calculating the rolling bloom filters for the txorphanage takes some CPU time from the scheduler thread. This can be observed for example in [this flamegraph](https://bitcoin-dev-tools.github.io/benchcoin/results/pr-172/20066462508/mainnet-default-instrumented-base-flamegraph.svg?x=920203898521&y=780), where handling the filter takes about 2.6% of total time (and most of the scheduler thread's time). During ibd the entries in the tx download bloom filter are just continuously rolled over and aren't consumed, since no mempool entries are created by incoming transactions from peers during ibd. The mempool does accept transactions via RPC, or the wallet at the time, however these don't interact with the orphanage and the txdownloadman, because adding anything to those is guarded by IsInitialBlockDownload() checks as well. We're usually latching ibd to false a few blocks before catching up to the tip, so this should also not significantly degrade the performance of the filter once fully caught up. ACKs for top commit: l0rinc: ACKe5f0613503instagibbs: ACKe5f0613503fjahr: Code review ACKe5f0613503Tree-SHA512: d667e677f5723c438cdf5b34f0f9c1ade7cc1b2e98530c23f14384514daa38217c4e7c3b756194b6831b590a487449c4514b52bf0fb461ae8083061722824270
This commit is contained in:
@@ -2084,12 +2084,12 @@ void PeerManagerImpl::BlockConnected(
|
||||
}
|
||||
|
||||
// The following task can be skipped since we don't maintain a mempool for
|
||||
// the historical chainstate.
|
||||
if (role.historical) {
|
||||
return;
|
||||
// the historical chainstate, or during ibd since we don't receive incoming
|
||||
// transactions from peers into the mempool.
|
||||
if (!role.historical && !m_chainman.IsInitialBlockDownload()) {
|
||||
LOCK(m_tx_download_mutex);
|
||||
m_txdownloadman.BlockConnected(pblock);
|
||||
}
|
||||
LOCK(m_tx_download_mutex);
|
||||
m_txdownloadman.BlockConnected(pblock);
|
||||
}
|
||||
|
||||
void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex)
|
||||
|
||||
Reference in New Issue
Block a user