Beispiel #1
0
        private void HandleInvalidShare(IShare share)
        {
            var miner = (IStratumMiner)share.Miner;

            if (miner.Username.Equals(share.PayoutUser) && share.Error != ShareError.InsideSleepWindow)
            {
                miner.InvalidShareCount++;
            }

            JsonRpcException exception = null; // the exception determined by the stratum error code.

            switch (share.Error)
            {
            case ShareError.DuplicateShare:
                exception = new DuplicateShareError(share.Nonce);
                break;

            case ShareError.IncorrectExtraNonce2Size:
                exception = new OtherError("Incorrect extranonce2 size");
                break;

            case ShareError.IncorrectNTimeSize:
                exception = new OtherError("Incorrect nTime size");
                break;

            case ShareError.IncorrectNonceSize:
                exception = new OtherError("Incorrect nonce size");
                break;

            case ShareError.JobNotFound:
                exception = new JobNotFoundError(share.JobId);
                break;

            case ShareError.LowDifficultyShare:
                exception = new LowDifficultyShare(share.Difficulty);
                break;

            case ShareError.NTimeOutOfRange:
                exception = new OtherError("nTime out of range");
                break;

            case ShareError.InsideSleepWindow:
                exception = new OtherError("Inside Sleep Window");
                break;
            }
            JsonRpcContext.SetException(exception); // set the stratum exception within the json-rpc reply.

            Debug.Assert(exception != null);        // exception should be never null when the share is marked as invalid.
            if (share.Error == ShareError.InsideSleepWindow)
            {
                if (DateTime.Now.Millisecond % 1000 == 0)
                {
                    _logger.Debug("Rejected share by miner {0:l}, reason: {1:l}", share.PayoutUser, exception.message);
                }
            }
            else
            {
                _logger.Debug("Rejected share by miner {0:l}, reason: {1:l}", share.PayoutUser, exception.message);
            }
        }
Beispiel #2
0
        private void HandleInvalidShare(IShare share)
        {
            var miner = (IStratumMiner)share.Miner;

            miner.InvalidShares++;

            JsonRpcException exception = null; // the exception determined by the stratum error code.

            switch (share.Error)
            {
            case ShareError.DuplicateShare:
                exception = new DuplicateShareError(share.Nonce);
                break;

            case ShareError.IncorrectExtraNonce2Size:
                exception = new OtherError("Incorrect extranonce2 size");
                break;

            case ShareError.IncorrectNTimeSize:
                exception = new OtherError("Incorrect nTime size");
                break;

            case ShareError.IncorrectNonceSize:
                exception = new OtherError("Incorrect nonce size");
                break;

            case ShareError.JobNotFound:
                exception = new JobNotFoundError(share.JobId);
                break;

            case ShareError.LowDifficultyShare:
                exception = new LowDifficultyShare(share.Difficulty);
                break;

            case ShareError.NTimeOutOfRange:
                exception = new OtherError("nTime out of range");
                break;
            }
            JsonRpcContext.SetException(exception); // set the stratum exception within the json-rpc reply.

            Debug.Assert(exception != null);        // exception should be never null when the share is marked as invalid.
            _logger.Debug("Rejected share by miner {0:l}, reason: {1:l}", miner.Username, exception.message);
        }
Beispiel #3
0
        private void HandleInvalidShare(IShare share)
        {
            var miner = (IStratumMiner)share.Miner;

            if (share.Error != ShareError.NegativeDifficultyShareOutdatedMiner)
            {
                miner.InvalidShareCount++;
            }
            else
            {
                _logger.Debug("Got negative share from merit-miner 0.1.0 miner. Skipping");
            }

            JsonRpcException exception = null; // the exception determined by the stratum error code.

            switch (share.Error)
            {
            case ShareError.DuplicateShare:
                exception = new DuplicateShareError(share.Nonce);
                break;

            case ShareError.IncorrectExtraNonce2Size:
                exception = new OtherError("Incorrect extranonce2 size");
                break;

            case ShareError.IncorrectNTimeSize:
                exception = new OtherError("Incorrect nTime size");
                break;

            case ShareError.IncorrectNonceSize:
                exception = new OtherError("Incorrect nonce size");
                break;

            case ShareError.JobNotFound:
                exception = new JobNotFoundError(share.JobId);
                break;

            case ShareError.NegativeDifficultyShareOutdatedMiner:
                exception = new OtherError("Negative share: most likely old merit-miner used");
                break;

            case ShareError.NegativeDifficultyShare:
                exception = new OtherError("Negative share");
                break;

            case ShareError.LowDifficultyShare:
                exception = new LowDifficultyShare(share.Difficulty);
                break;

            case ShareError.NTimeOutOfRange:
                exception = new OtherError("nTime out of range");
                break;

            case ShareError.IncorrectCycle:
                exception = new OtherError("Incorrect cycle");
                break;
            }
            JsonRpcContext.SetException(exception); // set the stratum exception within the json-rpc reply.

            Debug.Assert(exception != null);        // exception should be never null when the share is marked as invalid.
            _logger.Debug("Rejected share by miner {0:l}, reason: {1:l}", miner.Username, exception.message);
        }