public void SendLogin() { try { StratumRpcRequest request; { LoginParams lp = new LoginParams() { login = this.login, pass = this.password }; request = new StratumRpcRequest(StratumCommand.Login); request.SetParams(lp); } if (GrinSend <StratumRpcRequest>(request)) { //Logger.Log(LogLevel.DEBUG, $"Login sent for connection id {id}."); } } catch (Exception ex) { Logger.Log(ex); } }
internal void SendSolution(Solution activeSolution) { try { // difficulty check here if (activeSolution.CheckDifficulty() && (CurrentJob != null && (ulong)currentHeight == activeSolution.job.height)) // && WaitForLoginConfirm == false) { SubmitParams pow = new SubmitParams() { height = activeSolution.job.height, nonce = activeSolution.job.nonce, pow = activeSolution.nonces.ToList(), job_id = activeSolution.job.jobID }; StratumRpcRequest request = new StratumRpcRequest(StratumCommand.Solution); request.SetParams(pow); //if (GrinSend<StratumRpcRequest>(request)) lock (solutionQueue) { ///use concurent queue solutionQueue.Enqueue(request); flushToStratum.Set(); Logger.Log(LogLevel.DEBUG, $"SOL-{activeSolution.job.hnonce} OUT {DateTime.Now.ToString("mm:ss.FFF")}"); } totalShares++; lastShare = DateTime.Now; } else { // low difficulty share // or job changed } } catch (Exception ex) { Logger.Log(ex); } }
public void RequestJob() { try { StratumRpcRequest request = new StratumRpcRequest(StratumCommand.GetJob); if (GrinSend <StratumRpcRequest>(request)) { //Logger.Log(LogLevel.DEBUG, $"job request sent for connection id {id}"); } } catch (Exception ex) { Logger.Log(ex); } }
internal void KeepAlive() { try { StratumRpcRequest request = new StratumRpcRequest(StratumCommand.Keepalive); if (GrinSend <StratumRpcRequest>(request)) { //Logger.Log(LogLevel.DEBUG, $"keepalive sent for connection id {id}"); } } catch (Exception ex) { Logger.Log(ex); } }