Beispiel #1
0
        public void should_return_valid_pending_and_queued_transactions()
        {
            var nonce = 3;

            _stateProvider.GetNonce(_address).Returns(new UInt256(nonce));
            var transactions = GetTransactions();
            var info         = _infoProvider.GetInfo(transactions);

            info.Pending.Count.Should().Be(1);
            info.Queued.Count.Should().Be(1);

            var pending = info.Pending.First();

            pending.Key.Should().Be(_address);
            pending.Value.Count.Should().Be(3);
            pending.Value.Sum(v => v.Value.Length).Should().Be(4);
            VerifyNonceAndTransactions(pending.Value.ElementAt(0), 3, 2);
            VerifyNonceAndTransactions(pending.Value.ElementAt(1), 4, 1);
            VerifyNonceAndTransactions(pending.Value.ElementAt(2), 5, 1);

            var queued = info.Queued.First();

            queued.Key.Should().Be(_address);
            queued.Value.Count.Should().Be(4);
            queued.Value.Sum(v => v.Value.Length).Should().Be(4);
            VerifyNonceAndTransactions(queued.Value.ElementAt(0), 1, 1);
            VerifyNonceAndTransactions(queued.Value.ElementAt(1), 2, 1);
            VerifyNonceAndTransactions(queued.Value.ElementAt(2), 8, 1);
            VerifyNonceAndTransactions(queued.Value.ElementAt(3), 9, 1);
        }
 public TransactionPoolInfo GetTransactionPoolInfo()
 => _transactionPoolInfoProvider.GetInfo(_transactionPool.GetPendingTransactions());