Ejemplo n.º 1
0
        public async Task <Miner> MineAsync(Address mineAddress, int?numberOfThreads, BlockHashed lastBlock, IEnumerable <TransactionSigned> transactions)
        {
            var miner          = MinerFactory.Create(mineAddress, lastBlock, transactions, _feedback);
            var threadsClosure = numberOfThreads;

            await _feedback.Execute("Mine",
                                    () => MineAsync(miner, threadsClosure),
                                    () => $"{nameof(mineAddress)}: {mineAddress}, {nameof(numberOfThreads)}: {threadsClosure}");

            return(miner);
        }
Ejemplo n.º 2
0
        private void RemoveTasks(int taskCount)
        {
            _feedback.Execute("RemoveTasks",
                              () =>
            {
                var tasksToRemove = new List <MinerTask>();
                for (var i = 0; i < taskCount; i++)
                {
                    tasksToRemove.Add(_tasks.Dequeue());
                }

                StopTasks(tasksToRemove);
            },
                              () => $"{nameof(taskCount)}: {taskCount}");
        }