diff --git a/NiceHashMiner/Miners/ClaymoreDual.cs b/NiceHashMiner/Miners/ClaymoreDual.cs index ec3d768..dd5954f 100644 --- a/NiceHashMiner/Miners/ClaymoreDual.cs +++ b/NiceHashMiner/Miners/ClaymoreDual.cs @@ -26,10 +26,8 @@ protected override int GET_MAX_CooldownTimeInMilliseconds() { } private string GetStartCommand(string url, string btcAdress, string worker) { - string useWorker = worker; - if (useWorker == null || useWorker == "") { - useWorker = "worker1"; - } + string username = GetUsername(btcAdress, worker); + string dualModeParams = ""; foreach (var pair in MiningSetup.MiningPairs) { if (pair.CurrentExtraLaunchParameters.Contains("-dual=")) { @@ -52,14 +50,14 @@ private string GetStartCommand(string url, string btcAdress, string worker) { } if (dual != AlgorithmType.NONE) { string urlSecond = Globals.GetLocationURL(dual, Globals.MiningLocation[ConfigManager.GeneralConfig.ServiceLocation], this.ConectionType); - dualModeParams = String.Format(" {0} -dpool {1} -dwal {2}", coinP, urlSecond, btcAdress); + dualModeParams = String.Format(" {0} -dpool {1} -dwal {2}", coinP, urlSecond, username); break; } } } return " " + GetDevicesCommandString() - + String.Format(" -epool {0} -ewal {1} -mport -{2} -eworker {3} -esm 3 -epsw x -allpools 1", url, btcAdress, APIPort, useWorker) + + String.Format(" -epool {0} -ewal {1} -mport -{2} -esm 3 -epsw x -allpools 1", url, username, APIPort) + dualModeParams; } diff --git a/NiceHashMiner/Miners/Equihash/OptiminerZcashMiner.cs b/NiceHashMiner/Miners/Equihash/OptiminerZcashMiner.cs index 8d9bbc4..2d6fd0e 100644 --- a/NiceHashMiner/Miners/Equihash/OptiminerZcashMiner.cs +++ b/NiceHashMiner/Miners/Equihash/OptiminerZcashMiner.cs @@ -36,10 +36,19 @@ private class JsonApiResponse { public Stratum stratum; } + // give some time or else it will crash + Stopwatch _startAPI = null; + bool _skipAPICheck = true; + int waitSeconds = 30; + public override void Start(string url, string btcAdress, string worker) { string username = GetUsername(btcAdress, worker); LastCommandLine = " " + GetDevicesCommandString() + " -m " + APIPort + " -s " + url + " -u " + username + " -p x"; ProcessHandle = _Start(); + + // + _startAPI = new Stopwatch(); + _startAPI.Start(); } protected override void _Stop(MinerStopType willswitch) { @@ -67,36 +76,41 @@ public override APIData GetSummary() { _currentMinerReadStatus = MinerAPIReadStatus.NONE; APIData ad = new APIData(MiningSetup.CurrentAlgorithmType); - JsonApiResponse resp = null; - try { - string DataToSend = GetHttpRequestNHMAgentStrin(""); - string respStr = GetAPIData(APIPort, DataToSend, true); - if (respStr != null && respStr.Contains("{")) { - int start = respStr.IndexOf("{"); - if (start > -1) { - string respStrJSON = respStr.Substring(start); - resp = JsonConvert.DeserializeObject(respStrJSON.Trim(), Globals.JsonSettings); + if (_skipAPICheck == false) { + JsonApiResponse resp = null; + try { + string DataToSend = GetHttpRequestNHMAgentStrin(""); + string respStr = GetAPIData(APIPort, DataToSend, true); + if (respStr != null && respStr.Contains("{")) { + int start = respStr.IndexOf("{"); + if (start > -1) { + string respStrJSON = respStr.Substring(start); + resp = JsonConvert.DeserializeObject(respStrJSON.Trim(), Globals.JsonSettings); + } } + //Helpers.ConsolePrint("OptiminerZcashMiner API back:", respStr); + } catch (Exception ex) { + Helpers.ConsolePrint("OptiminerZcashMiner", "GetSummary exception: " + ex.Message); } - //Helpers.ConsolePrint("OptiminerZcashMiner API back:", respStr); - } catch (Exception ex) { - Helpers.ConsolePrint("OptiminerZcashMiner", "GetSummary exception: " + ex.Message); - } - if (resp != null && resp.solution_rate != null) { - //Helpers.ConsolePrint("OptiminerZcashMiner API back:", "resp != null && resp.error == null"); - const string total_key = "Total"; - const string _5s_key = "5s"; - if (resp.solution_rate.ContainsKey(total_key)) { - var total_solution_rate_dict = resp.solution_rate[total_key]; - if (total_solution_rate_dict != null && total_solution_rate_dict.ContainsKey(_5s_key)) { - ad.Speed = total_solution_rate_dict[_5s_key]; - _currentMinerReadStatus = MinerAPIReadStatus.GOT_READ; + if (resp != null && resp.solution_rate != null) { + //Helpers.ConsolePrint("OptiminerZcashMiner API back:", "resp != null && resp.error == null"); + const string total_key = "Total"; + const string _5s_key = "5s"; + if (resp.solution_rate.ContainsKey(total_key)) { + var total_solution_rate_dict = resp.solution_rate[total_key]; + if (total_solution_rate_dict != null && total_solution_rate_dict.ContainsKey(_5s_key)) { + ad.Speed = total_solution_rate_dict[_5s_key]; + _currentMinerReadStatus = MinerAPIReadStatus.GOT_READ; + } + } + if (ad.Speed == 0) { + _currentMinerReadStatus = MinerAPIReadStatus.READ_SPEED_ZERO; } } - if (ad.Speed == 0) { - _currentMinerReadStatus = MinerAPIReadStatus.READ_SPEED_ZERO; - } + } else if (_skipAPICheck && _startAPI.Elapsed.TotalSeconds > waitSeconds) { + _startAPI.Stop(); + _skipAPICheck = false; } return ad; diff --git a/NiceHashMiner/Miners/Grouping/MinerPaths.cs b/NiceHashMiner/Miners/Grouping/MinerPaths.cs index fa14da2..3f5063a 100644 --- a/NiceHashMiner/Miners/Grouping/MinerPaths.cs +++ b/NiceHashMiner/Miners/Grouping/MinerPaths.cs @@ -26,15 +26,15 @@ public static class Data { public const string ccminer_tpruvot = _bin + @"\ccminer_tpruvot.exe"; public const string ccminer_cryptonight = _bin + @"\ccminer_cryptonight.exe"; public const string ccminer_x11gost = _bin + @"\ccminer_x11gost.exe"; - /// - /// cpuminers opt new - /// - public const string cpuminer_opt_AVX2_AES = _bin + @"\cpuminer_opt_AVX2_AES.exe"; - public const string cpuminer_opt_AVX2 = _bin + @"\cpuminer_opt_AVX2.exe"; - public const string cpuminer_opt_AVX_AES = _bin + @"\cpuminer_opt_AVX_AES.exe"; - public const string cpuminer_opt_AVX = _bin + @"\cpuminer_opt_AVX.exe"; - public const string cpuminer_opt_AES = _bin + @"\cpuminer_opt_AES.exe"; - public const string cpuminer_opt_SSE2 = _bin + @"\cpuminer_opt_SSE2.exe"; + ///// + ///// cpuminers opt new + ///// + //public const string cpuminer_opt_AVX2_AES = _bin + @"\cpuminer_opt_AVX2_AES.exe"; + //public const string cpuminer_opt_AVX2 = _bin + @"\cpuminer_opt_AVX2.exe"; + //public const string cpuminer_opt_AVX_AES = _bin + @"\cpuminer_opt_AVX_AES.exe"; + //public const string cpuminer_opt_AVX = _bin + @"\cpuminer_opt_AVX.exe"; + //public const string cpuminer_opt_AES = _bin + @"\cpuminer_opt_AES.exe"; + //public const string cpuminer_opt_SSE2 = _bin + @"\cpuminer_opt_SSE2.exe"; /// /// ethminers /// @@ -78,8 +78,8 @@ public static bool IsMinerAlgorithmAvaliable(List algos, MinerBaseTyp public static string GetPathFor(MinerBaseType minerBaseType, AlgorithmType algoType, DeviceGroupType devGroupType, string devCodenameAMD, bool isOptimizedAMD, CPUExtensionType MostOptimizedCPUExtensionType) { switch (minerBaseType) { - case MinerBaseType.cpuminer: - return CPU_GROUP.cpu_miner_opt(MostOptimizedCPUExtensionType); + //case MinerBaseType.cpuminer: + // return CPU_GROUP.cpu_miner_opt(MostOptimizedCPUExtensionType); case MinerBaseType.ccminer: return NVIDIA_GROUPS.ccminer_path(algoType, devGroupType); case MinerBaseType.sgminer: @@ -225,20 +225,20 @@ public static string ClaymorePath(AlgorithmType type) { } } - static class CPU_GROUP { - public static string cpu_miner_opt(CPUExtensionType type) { - // algorithmType is not needed ATM - // algorithmType: AlgorithmType - if (CPUExtensionType.AVX2_AES == type) { return Data.cpuminer_opt_AVX2_AES; } - if (CPUExtensionType.AVX2 == type) { return Data.cpuminer_opt_AVX2; } - if (CPUExtensionType.AVX_AES == type) { return Data.cpuminer_opt_AVX_AES; } - if (CPUExtensionType.AVX == type) { return Data.cpuminer_opt_AVX; } - if (CPUExtensionType.AES == type) { return Data.cpuminer_opt_AES; } - if (CPUExtensionType.SSE2 == type) { return Data.cpuminer_opt_SSE2; } - - return Data.NONE; // should not happen - } - } + //static class CPU_GROUP { + // public static string cpu_miner_opt(CPUExtensionType type) { + // // algorithmType is not needed ATM + // // algorithmType: AlgorithmType + // if (CPUExtensionType.AVX2_AES == type) { return Data.cpuminer_opt_AVX2_AES; } + // if (CPUExtensionType.AVX2 == type) { return Data.cpuminer_opt_AVX2; } + // if (CPUExtensionType.AVX_AES == type) { return Data.cpuminer_opt_AVX_AES; } + // if (CPUExtensionType.AVX == type) { return Data.cpuminer_opt_AVX; } + // if (CPUExtensionType.AES == type) { return Data.cpuminer_opt_AES; } + // if (CPUExtensionType.SSE2 == type) { return Data.cpuminer_opt_SSE2; } + + // return Data.NONE; // should not happen + // } + //} } } diff --git a/NiceHashMiner/Miners/Parsing/ExtraLaunchParameters.cs b/NiceHashMiner/Miners/Parsing/ExtraLaunchParameters.cs index 344ebbe..770bdb0 100644 --- a/NiceHashMiner/Miners/Parsing/ExtraLaunchParameters.cs +++ b/NiceHashMiner/Miners/Parsing/ExtraLaunchParameters.cs @@ -176,10 +176,11 @@ public static class ExtraLaunchParameters { new MinerOptionPackage( MinerType.OptiminerZcash, new List() { - new MinerOption("ForceGenericKernel" , "", "--force-generic-kernel", null, MinerOptionFlagType.Uni, ""), - new MinerOption("ExperimentalKernel" , "", "--experimental-kernel", null, MinerOptionFlagType.Uni, ""), - new MinerOption("nodevfee" , "", "--nodevfee", null, MinerOptionFlagType.Uni, ""), + new MinerOption("ForceGenericKernel" , "--force-generic-kernel", "--force-generic-kernel", null, MinerOptionFlagType.Uni, ""), + new MinerOption("ExperimentalKernel" , "--experimental-kernel", "--experimental-kernel", null, MinerOptionFlagType.Uni, ""), + new MinerOption("nodevfee" , "--nodevfee", "--nodevfee", null, MinerOptionFlagType.Uni, ""), new MinerOption("Intensity" , "-i", "--intensity", "0", MinerOptionFlagType.DuplicateMultiParam, ""), + new MinerOption("PciMode" , "--pci-mode", "--pci-mode", "", MinerOptionFlagType.SingleParam, ""), }, new List() ),