Пример #1
0
        public void PreProcess(HttpContext context, string method, JArray _params)
        {
            if (method == "sendrawtransaction")
            {
                JObject res = new JObject();

                Transaction tx       = Transaction.DeserializeFrom(_params[0].AsString().HexToBytes());
                Snapshot    snapshot = Blockchain.Singleton.GetSnapshot();
                MemoryPool  MemPool  = Blockchain.Singleton.MemPool;

                PreVerify(tx, snapshot, MemPool.GetVerifiedTransactions());
            }
        }
Пример #2
0
        public void TestGetVerifiedTransactions()
        {
            var tx1 = CreateTransaction();
            var tx2 = CreateTransaction();

            _unit.TryAdd(tx1.Hash, tx1);
            _unit.InvalidateVerifiedTransactions();
            _unit.TryAdd(tx2.Hash, tx2);
            IEnumerable <Transaction> enumerable = _unit.GetVerifiedTransactions();

            enumerable.Count().Should().Be(1);
            var enumerator = enumerable.GetEnumerator();

            enumerator.MoveNext();
            enumerator.Current.Should().BeSameAs(tx2);
        }
Пример #3
0
        public void TestGetVerifiedTransactions()
        {
            var snapshot = Blockchain.Singleton.GetSnapshot();
            var tx1      = CreateTransaction();
            var tx2      = CreateTransaction();

            _unit.TryAdd(tx1, snapshot);
            _unit.InvalidateVerifiedTransactions();
            _unit.TryAdd(tx2, snapshot);
            IEnumerable <Transaction> enumerable = _unit.GetVerifiedTransactions();

            enumerable.Count().Should().Be(1);
            var enumerator = enumerable.GetEnumerator();

            enumerator.MoveNext();
            enumerator.Current.Should().BeSameAs(tx2);
        }