Skip to content

Commit

Permalink
Fix invalid address for nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
lwYeo committed Nov 29, 2018
1 parent 78822a4 commit 42d3148
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions SoliditySHA3Miner/NetworkInterface/MasterInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class MasterInterface : IDisposable
{
public static class RequestMethods
{
public const string GetMasterAddress = "GetMasterAddress";
public const string GetMinerAddress = "GetMinerAddress";
public const string GetMaximumTarget = "GetMaximumTarget";
public const string GetKingAddress = "GetKingAddress";
public const string GetChallenge = "GetChallenge";
Expand Down Expand Up @@ -182,14 +182,14 @@ public MasterInterface(INetworkInterface networkInterface, int pauseOnFailedScan
if (Miner.Work.KingAddress != null)
m_kingEthAddress = Utils.Numerics.Byte20ArrayToAddressString(Miner.Work.KingAddress);

m_minerEthAddress = networkInterface.MinerAddress;
m_maxTarget = Utils.Numerics.Byte32ArrayToHexString(
networkInterface.MaxTarget.Value.ToByteArray(isUnsigned: true, isBigEndian: true));

if (networkInterface.CurrentChallenge == null)
networkInterface.UpdateMiningParameters();
else
{
m_minerEthAddress = networkInterface.MinerAddress;
m_challenge = Utils.Numerics.Byte32ArrayToHexString(networkInterface.CurrentChallenge);
m_difficulty = Utils.Numerics.Byte32ArrayToHexString(
networkInterface.Difficulty.Value.ToByteArray(isUnsigned: true, isBigEndian: true));
Expand Down Expand Up @@ -290,7 +290,7 @@ private void ProcessApiDataResponse(HttpListenerRequest request, HttpListenerRes

switch (jMethodName)
{
case RequestMethods.GetMasterAddress:
case RequestMethods.GetMinerAddress:
jResponse = GetMasterResult(m_minerEthAddress);
break;

Expand Down Expand Up @@ -377,6 +377,7 @@ private void NetworkInterface_OnNewDifficulty(INetworkInterface sender, HexBigIn
private void NetworkInterface_OnNewChallenge(INetworkInterface sender, byte[] challenge, string address)
{
m_challenge = Utils.Numerics.Byte32ArrayToHexString(challenge);
m_minerEthAddress = address;

if (m_isCurrentChallengeStopSolving)
{
Expand Down
2 changes: 1 addition & 1 deletion SoliditySHA3Miner/NetworkInterface/SlaveInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public SlaveInterface(string masterURL, int updateInterval, int hashratePrintInt

Program.Print(string.Format("[INFO] Waiting for master instance ({0}) to start...", SubmitURL));

var getMasterAddress = MasterInterface.GetMasterParameter(MasterInterface.RequestMethods.GetMasterAddress);
var getMasterAddress = MasterInterface.GetMasterParameter(MasterInterface.RequestMethods.GetMinerAddress);
var getMaximumTarget = MasterInterface.GetMasterParameter(MasterInterface.RequestMethods.GetMaximumTarget);
var getKingAddress = MasterInterface.GetMasterParameter(MasterInterface.RequestMethods.GetKingAddress);

Expand Down
2 changes: 1 addition & 1 deletion SoliditySHA3Miner/NetworkInterface/Web3Interface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ private void UpdateMinerTimer_Elapsed(object sender, ElapsedEventArgs e)
if (m_lastParameters == null || miningParameters.Challenge.Value != m_lastParameters.Challenge.Value)
{
Program.Print(string.Format("[INFO] New challenge detected {0}...", miningParameters.ChallengeByte32String));
OnNewChallenge(this, miningParameters.ChallengeByte32, miningParameters.EthAddress);
OnNewChallenge(this, miningParameters.ChallengeByte32, MinerAddress);

if (m_challengeReceiveDateTime == DateTime.MinValue)
m_challengeReceiveDateTime = DateTime.Now;
Expand Down

0 comments on commit 42d3148

Please sign in to comment.