Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Ethminer jobparams fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Weichhold committed Oct 24, 2018
1 parent c7c7789 commit 52f3b04
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Miningcore/Blockchain/Ethereum/EthereumJobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private JsonRpcRequest DeserializeRequest(byte[] data)

#region API-Surface

public IObservable<object> Jobs { get; private set; }
public IObservable<object[]> Jobs { get; private set; }

public override void Configure(PoolConfig poolConfig, ClusterConfig clusterConfig)
{
Expand Down
25 changes: 22 additions & 3 deletions src/Miningcore/Blockchain/Ethereum/EthereumPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private async Task EnsureInitialWorkSent(StratumClient client)
}
}

protected virtual Task OnNewJobAsync(object jobParams)
protected virtual Task OnNewJobAsync(object[] jobParams)
{
currentJobParams = jobParams;

Expand Down Expand Up @@ -266,8 +266,27 @@ protected virtual Task OnNewJobAsync(object jobParams)
if (context.ApplyPendingDifficulty())
await client.NotifyAsync(EthereumStratumMethods.SetDifficulty, new object[] { context.Difficulty });
// send job
await client.NotifyAsync(EthereumStratumMethods.MiningNotify, currentJobParams);
if (!context.IsEthminer)
{
// send job
await client.NotifyAsync(EthereumStratumMethods.MiningNotify, currentJobParams);
}
else
{
// clone and patch jobparams
var tmpParams = new object[]
{
jobParams[0],
"0x" + jobParams[1],
"0x" + jobParams[2],
jobParams[3]
};
logger.Info("ethminer jobparams patch");
await client.NotifyAsync(EthereumStratumMethods.MiningNotify, tmpParams);
}
}
});

Expand Down
2 changes: 2 additions & 0 deletions src/Miningcore/Blockchain/Ethereum/EthereumWorkerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ public class EthereumWorkerContext : WorkerContextBase
public bool IsInitialWorkSent { get; set; } = false;

public string ExtraNonce1 { get; set; }

public bool IsEthminer => Miner?.ToLower().Contains("ethminer") == true;
}
}

0 comments on commit 52f3b04

Please sign in to comment.