Beispiel #1
0
 public FeeTooLowFilter(IChainHeadInfoProvider headInfo, IAccountStateProvider accountStateProvider, TxDistinctSortedPool txs, ILogger logger)
 {
     _specProvider = headInfo.SpecProvider;
     _headInfo     = headInfo;
     _accounts     = accountStateProvider;
     _txs          = txs;
     _logger       = logger;
 }
Beispiel #2
0
        public void Distinct_transactions_are_all_added(Transaction[] transactions, int expectedCount)
        {
            var pool = new TxDistinctSortedPool(Capacity, LimboLogs.Instance);

            foreach (var transaction in transactions)
            {
                pool.TryInsert(transaction.Hash, transaction);
            }

            pool.Count.Should().Be(expectedCount);
        }
Beispiel #3
0
        public void Same_transactions_are_all_replaced_with_highest_gas_price(bool gasPriceAscending)
        {
            var pool = new TxDistinctSortedPool(Capacity, LimboLogs.Instance);

            var transactions = gasPriceAscending
                ? GenerateTransactions(address: TestItem.AddressB, nonce: 3).OrderBy(t => t.GasPrice)
                : GenerateTransactions(address: TestItem.AddressB, nonce: 3).OrderByDescending(t => t.GasPrice);

            foreach (var transaction in transactions)
            {
                pool.TryInsert(transaction.Hash, transaction);
            }

            pool.Count.Should().Be(1);
            pool.GetSnapshot().First().GasPrice.Should().Be(Capacity - 1);
        }
Beispiel #4
0
 public GapNonceFilter(IAccountStateProvider accountStateProvider, TxDistinctSortedPool txs, ILogger logger)
 {
     _txs      = txs;
     _accounts = accountStateProvider;
     _logger   = logger;
 }