Example #1
0
        public async Task IterationSetup()
        {
            var transactions = await _osTestHelper.GenerateTransferTransactions(TransactionCount);

            await _txHub.HandleTransactionsReceivedAsync(new TransactionsReceivedEvent
            {
                Transactions = transactions
            });

            var chain = await _blockchainService.GetChainAsync();

            _block = _osTestHelper.GenerateBlock(chain.BestChainHash, chain.BestChainHeight, transactions);
            await _blockchainService.AddBlockAsync(_block);

            await _chainBlockLinks.SetAsync(
                chain.Id.ToStorageKey() + KernelConstants.StorageKeySeparator + _block.GetHash().ToStorageKey(),
                new ChainBlockLink()
            {
                BlockHash         = _block.GetHash(),
                Height            = _block.Height,
                PreviousBlockHash = _block.Header.PreviousBlockHash,
                IsLinked          = true
            });

            await _blockchainService.SetBestChainAsync(chain, _block.Height, _block.GetHash());
        }
Example #2
0
 public async Task HandleTransactionsReceivedTest()
 {
     await _txHub.HandleTransactionsReceivedAsync(new TransactionsReceivedEvent
     {
         Transactions = _transactions
     });
 }
Example #3
0
        public async Task BroadcastTransactions(IEnumerable <Transaction> transactions)
        {
            var transactionsReceivedEvent = new TransactionsReceivedEvent
            {
                Transactions = transactions
            };

            await _txHub.HandleTransactionsReceivedAsync(transactionsReceivedEvent);
        }
 public void HandleTransactionsReceivedTest()
 {
     AsyncHelper.RunSync(async() =>
     {
         await _txHub.HandleTransactionsReceivedAsync(new TransactionsReceivedEvent
         {
             Transactions = _transactions
         });
     });
     _counter.Increment();
 }
        public void Setup(BenchmarkContext context)
        {
            _osTestHelper      = GetRequiredService <OSTestHelper>();
            _txHub             = GetRequiredService <ITxHub>();
            _blockchainService = GetRequiredService <IBlockchainService>();

            _counter = context.GetCounter("TestCounter");

            AsyncHelper.RunSync(async() =>
            {
                var transactions = await _osTestHelper.GenerateTransferTransactions(1000);

                await _txHub.HandleTransactionsReceivedAsync(new TransactionsReceivedEvent
                {
                    Transactions = transactions
                });

                await _osTestHelper.MinedOneBlock();
            });
        }
 public async Task HandleEventAsync(TransactionsReceivedEvent eventData)
 {
     await _txHub.HandleTransactionsReceivedAsync(eventData);
 }