예제 #1
0
        public async Task IterationSetup()
        {
            var chain = await _blockchainService.GetChainAsync();

            var tokenAmount = TransactionCount / GroupCount;

            (_prepareTransactions, _keyPairs) = await _osTestHelper.PrepareTokenForParallel(GroupCount, tokenAmount);

            _block = _osTestHelper.GenerateBlock(chain.BestChainHash, chain.BestChainHeight, _prepareTransactions);
            await _blockExecutingService.ExecuteBlockAsync(_block.Header, _prepareTransactions);

            await _osTestHelper.BroadcastTransactions(_prepareTransactions);

            _block = (await _minerService.MineAsync(chain.BestChainHash, chain.BestChainHeight,
                                                    TimestampHelper.GetUtcNow(), TimestampHelper.DurationFromSeconds(4))).Block;

            _systemTransactions = await _osTestHelper.GenerateTransferTransactions(1);

            _cancellableTransactions = await _osTestHelper.GenerateTransactionsWithoutConflictAsync(_keyPairs, tokenAmount);

            chain = await _blockchainService.GetChainAsync();

            _block = _osTestHelper.GenerateBlock(chain.BestChainHash, chain.BestChainHeight,
                                                 _systemTransactions.Concat(_cancellableTransactions));
        }