Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recreation of light blob tx collection #7584

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
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
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
Loading