Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/Nethermind/Nethermind.Xdc/XdcPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,24 @@ public void EndRound(ulong round)
{
using var lockRelease = _lock.Acquire();
{
List<(ulong Round, Hash256 Hash)>? keysToRemove = null;
foreach (var key in _items.Keys)
{
if (key.Round <= round && _items.Remove(key, out ArrayPoolList<T> list))
if (key.Round <= round)
{
list?.Dispose();
keysToRemove ??= new List<(ulong, Hash256)>();
keysToRemove.Add(key);
}
}

if (keysToRemove is not null)
{
foreach (var key in keysToRemove)
{
if (_items.Remove(key, out ArrayPoolList<T> list))
{
list?.Dispose();
}
}
}
}
Expand Down