Skip to content
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
23 changes: 23 additions & 0 deletions src/Nethermind/Nethermind.TxPool.Test/TxBroadcasterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,29 @@ public void calculation_of_baseFeeThreshold_should_handle_overflow_correctly([Va
: baseFeeThreshold);
}

[Test]
public void should_broadcast_light_transactions_without_wrappers()
{
// Arrange
var mockChainHeadInfoProvider = Substitute.For<IChainHeadInfoProvider>();
mockChainHeadInfoProvider.CurrentProofVersion.Returns(ProofVersion.V0);

var gossipPolicy = new SpecDrivenTxGossipPolicy(mockChainHeadInfoProvider);

var blobTransaction = Build.A.Transaction
.WithShardBlobTxTypeAndFields()
.SignedAndResolved(_ethereumEcdsa, TestItem.PrivateKeyA)
.TestObject;

var lightTransaction = new LightTransaction(blobTransaction);

// Act
bool result = gossipPolicy.ShouldGossipTransaction(lightTransaction);
Comment thread
LukaszRozmej marked this conversation as resolved.

// Assert
result.Should().BeTrue("LightTransaction from blob transaction should be gossiped when proof version matches.");
Comment thread
marcindsobczak marked this conversation as resolved.
Outdated
}

private (IList<Transaction> expectedTxs, IList<Hash256> expectedHashes) GetTxsAndHashesExpectedToBroadcast(Transaction[] transactions, int expectedCountTotal)
{
List<Transaction> expectedTxs = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class SpecDrivenTxGossipPolicy(IChainHeadInfoProvider chainHeadInfoProvid
private IChainHeadInfoProvider ChainHeadInfoProvider { get; } = chainHeadInfoProvider;

public bool ShouldGossipTransaction(Transaction tx) =>
!tx.SupportsBlobs || (tx.NetworkWrapper as ShardBlobNetworkWrapper)?.Version == ChainHeadInfoProvider.CurrentProofVersion;
!tx.SupportsBlobs || tx.GetProofVersion() == ChainHeadInfoProvider.CurrentProofVersion;
}
Loading