Exemple #1
0
        public void filter_properly_already_pending_hashes()
        {
            _response  = new List <Keccak>();
            _requestor = new PooledTxsRequestor(_txPool);
            _requestor.RequestTransactions(_doNothing, new List <Keccak> {
                TestItem.KeccakA, TestItem.KeccakB, TestItem.KeccakC
            });

            _request = new List <Keccak> {
                TestItem.KeccakA, TestItem.KeccakB, TestItem.KeccakC
            };
            _requestor.RequestTransactions(Send, _request);
            _response.Should().BeEmpty();
        }
Exemple #2
0
 public void can_handle_empty_argument()
 {
     _response  = new List <Keccak>();
     _requestor = new PooledTxsRequestor(_txPool);
     _requestor.RequestTransactions(Send, new List <Keccak>());
     _response.Should().BeEmpty();
 }
Exemple #3
0
        public void filter_properly_newPooledTxHashes()
        {
            _response  = new List <Keccak>();
            _requestor = new PooledTxsRequestor(_txPool);
            _requestor.RequestTransactions(_doNothing, new List <Keccak> {
                TestItem.KeccakA, TestItem.KeccakD
            });

            _request = new List <Keccak> {
                TestItem.KeccakA, TestItem.KeccakB, TestItem.KeccakC
            };
            _expected = new List <Keccak> {
                TestItem.KeccakB, TestItem.KeccakC
            };
            _requestor.RequestTransactions(Send, _request);
            _response.Should().BeEquivalentTo(_expected);
        }
        protected virtual void Handle(NewPooledTransactionHashesMessage msg)
        {
            Metrics.Eth65NewPooledTransactionHashesReceived++;
            Stopwatch stopwatch = Stopwatch.StartNew();

            _pooledTxsRequestor.RequestTransactions(Send, msg.Hashes.ToArray());

            stopwatch.Stop();
            if (Logger.IsTrace)
            {
                Logger.Trace($"OUT {Counter:D5} {nameof(NewPooledTransactionHashesMessage)} to {Node:c} " +
                             $"in {stopwatch.Elapsed.TotalMilliseconds}ms");
            }
        }
Exemple #5
0
        public void filter_properly_hashes_present_in_hashCache()
        {
            _response = new List <Keccak>();
            ITxPool txPool = Substitute.For <ITxPool>();

            txPool.IsInHashCache(Arg.Any <Keccak>()).Returns(true);
            _requestor = new PooledTxsRequestor(txPool);

            _request = new List <Keccak> {
                TestItem.KeccakA, TestItem.KeccakB
            };
            _expected = new List <Keccak> {
            };
            _requestor.RequestTransactions(Send, _request);
            _response.Should().BeEquivalentTo(_expected);
        }