mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 06:04:42 +02:00
validation: emit block mempool removal signal from ConnectTip
Return the removed mempool transaction info from CTxMemPool::removeForBlock instead of dispatching the MempoolTransactionsRemovedForBlock notification from the mempool. Emit it from ConnectTip after mempool removal and before BlockConnected, passing the connected block, the removed mempool transactions, and the block height to the callback. Because the signal now originates from ConnectTip, where the IBD state is known, gate it on !IsInitialBlockDownload(): the notification is no longer fired for blocks connected during initial block download or reindex, while the mempool removal in removeForBlock still runs unconditionally. This keeps fee rate estimators from recording blocks connected before the node is synced.
This commit is contained in:
@@ -156,7 +156,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, Cha
|
||||
|
||||
// Try updating the mempool for this block, as though it were mined.
|
||||
LOCK2(::cs_main, tx_pool.cs);
|
||||
tx_pool.removeForBlock(block_template->block.vtx, chainstate.m_chain.Height() + 1);
|
||||
tx_pool.removeForBlock(block_template->block.vtx);
|
||||
|
||||
// Now try to add those transactions back, as though a reorg happened.
|
||||
std::vector<Txid> hashes_to_update;
|
||||
|
||||
Reference in New Issue
Block a user