コード例 #1
0
        public void should_ignore_old_scheme_signatures()
        {
            _transactionPool = CreatePool(_noTransactionStorage);
            Transaction          tx     = Build.A.Transaction.SignedAndResolved(_ethereumEcdsa, TestItem.PrivateKeyA, 1).TestObject;
            AddTransactionResult result = _transactionPool.AddTransaction(tx, 1);

            _transactionPool.GetPendingTransactions().Length.Should().Be(0);
            result.Should().Be(AddTransactionResult.OldScheme);
        }
コード例 #2
0
        public void should_add_valid_transactions()
        {
            _transactionPool = CreatePool(_noTransactionStorage);
            Transaction          tx     = Build.A.Transaction.SignedAndResolved(_ethereumEcdsa, TestItem.PrivateKeyA, RopstenSpecProvider.ByzantiumBlockNumber).TestObject;
            AddTransactionResult result = _transactionPool.AddTransaction(tx, 1);

            _transactionPool.GetPendingTransactions().Length.Should().Be(1);
            result.Should().Be(AddTransactionResult.Added);
        }
コード例 #3
0
        public void should_ignore_transactions_with_different_chain_id()
        {
            _transactionPool = CreatePool(_noTransactionStorage);
            EthereumEcdsa        ecdsa  = new EthereumEcdsa(MainNetSpecProvider.Instance, _logManager);
            Transaction          tx     = Build.A.Transaction.SignedAndResolved(ecdsa, TestItem.PrivateKeyA, MainNetSpecProvider.ByzantiumBlockNumber).TestObject;
            AddTransactionResult result = _transactionPool.AddTransaction(tx, 1);

            _transactionPool.GetPendingTransactions().Length.Should().Be(0);
            result.Should().Be(AddTransactionResult.InvalidChainId);
        }
コード例 #4
0
        public void should_ignore_already_known()
        {
            _transactionPool = CreatePool(_noTransactionStorage);
            Transaction          tx      = Build.A.Transaction.SignedAndResolved(_ethereumSigner, TestItem.PrivateKeyA, RopstenSpecProvider.ByzantiumBlockNumber).TestObject;
            AddTransactionResult result1 = _transactionPool.AddTransaction(tx, 1);
            AddTransactionResult result2 = _transactionPool.AddTransaction(tx, 1);

            _transactionPool.GetPendingTransactions().Length.Should().Be(1);
            result1.Should().Be(AddTransactionResult.Added);
            result2.Should().Be(AddTransactionResult.AlreadyKnown);
        }