protected void EnsureProtocolVersion(EthereumWorkerContext context, int version) { if (context.ProtocolVersion != version) { throw new StratumException(StratumError.MinusOne, $"protocol mismatch"); } }
private async Task SendWork(EthereumWorkerContext context, StratumConnection connection, object requestId) { var parameters = manager.GetWorkParamsForStratum(context); // respond await connection.RespondAsync(parameters, requestId); }
private static string GetWorkerNameFromV1Request(JsonRpcRequest request, EthereumWorkerContext context) { if (request.Extra?.TryGetValue(EthereumConstants.RpcRequestWorkerPropertyName, out var tmp) == true && tmp is string workerNameValue) { return(workerNameValue); } return(context.Worker); }
private async Task SendJob(EthereumWorkerContext context, StratumConnection connection, object parameters) { // varDiff: if the client has a pending difficulty change, apply it now if (context.ApplyPendingDifficulty()) { await connection.NotifyAsync(EthereumStratumMethods.SetDifficulty, new object[] { context.Difficulty }); } // send job await connection.NotifyAsync(EthereumStratumMethods.MiningNotify, parameters); }