Пример #1
0
 protected void EnsureProtocolVersion(EthereumWorkerContext context, int version)
 {
     if (context.ProtocolVersion != version)
     {
         throw new StratumException(StratumError.MinusOne, $"protocol mismatch");
     }
 }
Пример #2
0
    private async Task SendWork(EthereumWorkerContext context, StratumConnection connection, object requestId)
    {
        var parameters = manager.GetWorkParamsForStratum(context);

        // respond
        await connection.RespondAsync(parameters, requestId);
    }
Пример #3
0
    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);
    }
Пример #4
0
    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);
    }