Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
flcl42 committed Apr 3, 2024
1 parent 0db20e1 commit 5321be7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,25 @@ public void should_send_up_to_MaxCount_hashes_in_one_NewPooledTransactionHashesM

_handler.SendNewTransactions(txs, false);

_session.Received(1).DeliverMessage(Arg.Is<NewPooledTransactionHashesMessage68>(m => m.Hashes.Count == txCount));
_session.Received(1).DeliverMessage(Arg.Is<NewPooledTransactionHashesMessage68>(m =>
m.Hashes.Count == txCount &&
m.Sizes.Count == txCount &&
m.Types.Count == txCount));
}

[Test]
public void should_send_blob_tx_announcement_in_NewPooledTransactionHashesMessage68()
{
Transaction tx = Build.A.Transaction.WithNonce((UInt256)0).WithShardBlobTxTypeAndFields().SignedAndResolved().TestObject;

_handler.SendNewTransaction(tx);

_session.Received(1).DeliverMessage(Arg.Is<NewPooledTransactionHashesMessage68>(m =>
m.Hashes.Count == 1 &&
m.Sizes.Count == 1 &&
m.Types.Count == 1 &&
m.Hashes[0] == tx.Hash &&
(TxType)m.Types[0] == tx.Type));
}

[TestCase(NewPooledTransactionHashesMessage68.MaxCount - 1)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Nethermind.Core.Extensions;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.Network.P2P.Messages;
using Nethermind.Network.P2P.Subprotocols.Eth.V62;
using Nethermind.Network.P2P.Subprotocols.Eth.V62.Messages;
using Nethermind.Network.P2P.Subprotocols.Eth.V63.Messages;
Expand Down Expand Up @@ -208,6 +207,7 @@ public virtual Task<IOwnedReadOnlyList<byte[]>> GetNodeData(IReadOnlyList<Hash25

private bool ShouldNotifyTransaction(Hash256? hash) => hash is not null && NotifiedTransactions.Set(hash);


public void SendNewTransaction(Transaction tx)
{
if (ShouldNotifyTransaction(tx.Hash))
Expand Down

0 comments on commit 5321be7

Please sign in to comment.