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 sending new single tx p2p update #6895

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Expand Up @@ -113,8 +113,8 @@ protected override void SendNewTransactionCore(Transaction tx)
else
{
SendMessage(
new ArrayPoolList<byte>((byte)tx.Type),
new ArrayPoolList<int>(tx.GetLength()),
new ArrayPoolList<byte>(1) { (byte)tx.Type },
new ArrayPoolList<int>(1) { tx.GetLength() },
new ArrayPoolList<Hash256>(1) { tx.Hash }
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Collections.Generic;
using Nethermind.Core;
using Nethermind.Core.Crypto;
using Nethermind.Logging;

namespace Nethermind.TxPool.Collections;

public class BlobTxDistinctSortedPool : TxDistinctSortedPool
public class BlobTxDistinctSortedPool(int capacity, IComparer<Transaction> comparer, ILogManager logManager)
: TxDistinctSortedPool(capacity, comparer, logManager)
{
private readonly ILogger _logger;

public BlobTxDistinctSortedPool(int capacity, IComparer<Transaction> comparer, ILogManager logManager)
: base(capacity, comparer, logManager)
{
_logger = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
}

protected override IComparer<Transaction> GetReplacementComparer(IComparer<Transaction> comparer)
=> comparer.GetBlobReplacementComparer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

using Nethermind.Core;
using Nethermind.Core.Collections;
using Nethermind.Core.Crypto;
using Nethermind.Core.Threading;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.TxPool.Comparison;
Expand Down Expand Up @@ -73,7 +72,7 @@ protected override void UpdateGroup(AddressAsKey groupKey, EnhancedSortedSet<Tra

public void UpdatePool(IAccountStateProvider accounts, Func<Address, AccountStruct, EnhancedSortedSet<Transaction>, IEnumerable<(Transaction Tx, UInt256? changedGasBottleneck)>> changingElements)
{
using var lockRelease = Lock.Acquire();
using McsLock.Disposable lockRelease = Lock.Acquire();

EnsureCapacity();
foreach ((AddressAsKey address, EnhancedSortedSet<Transaction> bucket) in _buckets)
Expand Down Expand Up @@ -122,7 +121,7 @@ private void UpdateGroupNonLocked(Address groupKey, AccountStruct groupValue, En

public void UpdateGroup(Address groupKey, AccountStruct groupValue, Func<Address, AccountStruct, EnhancedSortedSet<Transaction>, IEnumerable<(Transaction Tx, UInt256? changedGasBottleneck)>> changingElements)
{
using var lockRelease = Lock.Acquire();
using McsLock.Disposable lockRelease = Lock.Acquire();

ArgumentNullException.ThrowIfNull(groupKey);
if (_buckets.TryGetValue(groupKey, out EnhancedSortedSet<Transaction>? bucket))
Expand Down