コード例 #1
0
        /// <summary>
        /// Async submits solution serializing execution in Farm's strand
        /// </summary>
        /// <param name="s">The s.</param>
        public void SubmitProofAsync(Solution s)
        {
            if (!_options.NoEval)
            {
                var r = EthashAux.Eval(s.Work.Epoch, s.Work.Header, s.Nonce);
                if (r.value > s.Work.Boundary)
                {
                    AccountSolution(s.MIdx, SolutionAccounting.Failed);
                    //WARNING
                    Console.WriteLine($"GPU {s.MIdx} gave incorrect result. Lower overclocking values if it happens frequently.");
                    return;
                }
                _onSolutionFound(this, new Solution
                {
                    Nonce   = s.Nonce,
                    MixHash = r.mixHash,
                    Work    = s.Work,
                    TStamp  = s.TStamp,
                    MIdx    = s.MIdx
                });
            }
            else
            {
                _onSolutionFound(this, s);
            }

#if DEBUG
            //if (_logOptions & LOG_SUBMIT)
            //NOTE
            Console.WriteLine($"Submit time: {(DateTime.Now - s.TStamp).Milliseconds} us.");
#endif
        }
コード例 #2
0
        public override void SubmitSolution(Solution solution)
        {
            // This is a fake submission only evaluated locally
            var submitStart     = DateTime.Now;
            var accepted        = EthashAux.Eval(solution.Work.Epoch, solution.Work.Header, solution.Nonce).value <= solution.Work.Boundary;
            var responseDelayMs = (DateTime.Now - submitStart).TotalMilliseconds;

            if (accepted)
            {
                _onSolutionAccepted?.Invoke(_f, this, responseDelayMs, solution.MIdx, false);
            }
            else
            {
                _onSolutionRejected?.Invoke(_f, this, responseDelayMs, solution.MIdx);
            }
        }