net processing: Check if we are in ibd before processing block for txdownloadman
This avoids wasting work on calculating bloom filters that aren't consumed during ibd and continuously re-calculated as now blocks get validated. Also update the functional test to document that transactions would now be requested again once out of IBD. Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
2 files changed
+7
-9
No files matched your search
@@ -2054,12 +2054,12 @@ void PeerManagerImpl::BlockConnected(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The following task can be skipped since we don't maintain a mempool for
|
// The following task can be skipped since we don't maintain a mempool for
|
||||||
// the historical chainstate.
|
// the historical chainstate, or during ibd since we don't receive incoming
|
||||||
if (role.historical) {
|
// transactions from peers into the mempool.
|
||||||
return;
|
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)
|
void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex)
|
||||||
|
|||||||
@@ -89,13 +89,11 @@ class P2PIBDTxRelayTest(BitcoinTestFramework):
|
|||||||
assert not node.getblockchaininfo()['initialblockdownload']
|
assert not node.getblockchaininfo()['initialblockdownload']
|
||||||
self.wait_until(lambda: all(peer['minfeefilter'] == NORMAL_FEE_FILTER for peer in node.getpeerinfo()))
|
self.wait_until(lambda: all(peer['minfeefilter'] == NORMAL_FEE_FILTER for peer in node.getpeerinfo()))
|
||||||
|
|
||||||
self.log.info("Check that txs confirmed during IBD are in the recently-confirmed filter once out of ibd")
|
self.log.info("Check that txs confirmed during IBD are not in the recently-confirmed filter once out of ibd")
|
||||||
peer_inver = self.nodes[0].add_p2p_connection(P2PDataStore())
|
peer_inver = self.nodes[0].add_p2p_connection(P2PDataStore())
|
||||||
peer_inver.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=ibd_wtxid)]))
|
peer_inver.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=ibd_wtxid)]))
|
||||||
self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY)
|
self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY)
|
||||||
peer_inver.sync_with_ping()
|
peer_inver.wait_for_getdata([ibd_wtxid])
|
||||||
with p2p_lock:
|
|
||||||
assert ibd_wtxid not in peer_inver.getdata_requests
|
|
||||||
self.nodes[0].disconnect_p2ps()
|
self.nodes[0].disconnect_p2ps()
|
||||||
|
|
||||||
self.log.info("Check that nodes process the same transaction, even when unsolicited, when no longer in IBD")
|
self.log.info("Check that nodes process the same transaction, even when unsolicited, when no longer in IBD")
|
||||||
|
|||||||
Reference in new issue
Block a user