public async Task IterationCleanup() { await _transactionManager.RemoveTransactionsAsync(_transactionIdList); await TransactionPoolService.CleanByTransactionIdsAsync(_transactionIdList); await TransactionPoolService.UpdateTransactionPoolByBestChainAsync(_chain.BestChainHash, _chain.BestChainHeight); _transactionIdList.Clear(); }
public async Task MineWithTxHubAsync() { var txCount = 0; var preBlockHash = _chain.BestChainHash; var preBlockHeight = _chain.BestChainHeight; while (txCount < TransactionCount) { var blockExecutedSet = await _minerService.MineAsync(preBlockHash, preBlockHeight, TimestampHelper.GetUtcNow(), TimestampHelper.DurationFromMilliseconds(4000)); txCount += blockExecutedSet.TransactionIds.Count(); _transactionIdList.AddRange(blockExecutedSet.TransactionIds.ToList()); await BlockchainService.SetBestChainAsync(_chain, preBlockHeight, preBlockHash); await TransactionPoolService.CleanByTransactionIdsAsync(blockExecutedSet.TransactionIds); await TransactionPoolService.UpdateTransactionPoolByBestChainAsync(preBlockHash, preBlockHeight); } }