make DisconnectedBlockTransactions responsible for its own memory management

Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
This commit is contained in:
glozow
2023-09-06 16:25:15 +01:00
parent cf5f1faa03
commit 4313c77400
4 changed files with 33 additions and 27 deletions

View File

@@ -73,9 +73,10 @@ static ReorgTxns CreateBlocks(size_t num_not_shared)
static void Reorg(const ReorgTxns& reorg)
{
DisconnectedBlockTransactions disconnectpool;
DisconnectedBlockTransactions disconnectpool{MAX_DISCONNECTED_TX_POOL_SIZE * 1000};
// Disconnect block
disconnectpool.AddTransactionsFromBlock(reorg.disconnected_txns);
const auto evicted = disconnectpool.AddTransactionsFromBlock(reorg.disconnected_txns);
assert(evicted.empty());
// Connect first block
disconnectpool.removeForBlock(reorg.connected_txns_1);