[refactor] batch-add transactions to DisconnectedBlockTransactions

No behavior change.
In a future commit, we can optimize by reserving vtx.size().
This commit is contained in:
glozow
2023-09-06 11:24:42 +01:00
parent 5666966dff
commit 925bb723ca
2 changed files with 12 additions and 6 deletions

View File

@@ -2721,9 +2721,7 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra
if (disconnectpool && m_mempool) {
// Save transactions to re-add to mempool at end of reorg
for (auto it = block.vtx.rbegin(); it != block.vtx.rend(); ++it) {
disconnectpool->addTransaction(*it);
}
disconnectpool->AddTransactionsFromBlock(block.vtx);
while (disconnectpool->DynamicMemoryUsage() > MAX_DISCONNECTED_TX_POOL_SIZE * 1000) {
// Drop the earliest entry, and remove its children from the mempool.
auto it = disconnectpool->queuedTx.get<insertion_order>().begin();