Skip to content

Commit

Permalink
Fix recreation of light blob tx collection (#7584)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcindsobczak authored Oct 10, 2024
1 parent e6d7733 commit 71335db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -65,7 +64,7 @@ protected override bool InsertCore(ValueHash256 key, Transaction value, AddressA
return false;
}

protected void AddToBlobIndex(Transaction blobTx)
private void AddToBlobIndex(Transaction blobTx)
{
if (blobTx.BlobVersionedHashes?.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ private void RecreateLightTxCollectionAndCache(ITxStorage blobTxStorage)
long startTime = Stopwatch.GetTimestamp();
foreach (LightTransaction lightBlobTx in blobTxStorage.GetAll())
{
if (base.TryInsert(lightBlobTx.Hash, lightBlobTx, out _))
if (lightBlobTx.SenderAddress is not null
&& base.InsertCore(lightBlobTx.Hash, lightBlobTx, lightBlobTx.SenderAddress))
{
AddToBlobIndex(lightBlobTx);
numberOfTxsInDb++;
numberOfBlobsInDb += lightBlobTx.BlobVersionedHashes?.Length ?? 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.TxPool/Collections/SortedPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public bool TryGetValue(TKey key, [NotNullWhen(true)] out TValue? value)
/// <param name="value">Element to insert.</param>
/// <param name="removed">Element removed because of exceeding capacity</param>
/// <returns>If element was inserted. False if element was already present in pool.</returns>
public virtual bool TryInsert(TKey key, TValue value, out TValue? removed)
public bool TryInsert(TKey key, TValue value, out TValue? removed)
{
using var lockRelease = Lock.Acquire();

Expand Down

0 comments on commit 71335db

Please sign in to comment.