Skip to content

Commit

Permalink
40
Browse files Browse the repository at this point in the history
  • Loading branch information
angelbbs committed Jul 21, 2021
1 parent 6b5ce41 commit 564029d
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 105 deletions.
Binary file modified LatestBuild/nhmlffLatest.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions NiceHashMiner/Devices/Algorithms/DefaultAlgorithms.cs
Expand Up @@ -166,6 +166,10 @@ public static class DefaultAlgorithms
ExtraLaunchParameters = "--enablezilcache=1"
},
new Algorithm(MinerBaseType.lolMiner, AlgorithmType.GrinCuckatoo32, "GrinCuckatoo32")
{
ExtraLaunchParameters = ""
},
new Algorithm(MinerBaseType.lolMiner, AlgorithmType.Autolykos, "Autolykos")
{
ExtraLaunchParameters = ""
}
Expand Down
2 changes: 1 addition & 1 deletion NiceHashMiner/Forms/Form_Main.cs
Expand Up @@ -330,7 +330,7 @@ public Form_Main()

Text += ForkString;
//Text += ConfigManager.GeneralConfig.ForkFixVersion.ToString();
Text += "39";
Text += "40";
Text += " for NiceHash";

var internalversion = Assembly.GetExecutingAssembly().GetName().Version;
Expand Down
26 changes: 13 additions & 13 deletions NiceHashMiner/Forms/Form_Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion NiceHashMiner/Miners/GMiner.cs
Expand Up @@ -31,6 +31,8 @@ public class GMiner : Miner
private const double DevFee = 2.0;
string gminer_var = "";
protected AlgorithmType SecondaryAlgorithmType = AlgorithmType.NONE;
private FileStream fs;
private int offset = 0;

public GMiner(AlgorithmType secondaryAlgorithmType) : base("GMiner")
{
Expand All @@ -42,6 +44,9 @@ public GMiner(AlgorithmType secondaryAlgorithmType) : base("GMiner")

public override void Start(string url, string btcAdress, string worker)
{
if (File.Exists("miners\\Gminer\\" + GetLogFileName()))
File.Delete("miners\\Gminer\\" + GetLogFileName());

LastCommandLine = GetStartCommand(url, btcAdress, worker);
const string vcp = "msvcp120.dll";
var vcpPath = WorkingDirectory + vcp;
Expand All @@ -58,6 +63,14 @@ public override void Start(string url, string btcAdress, string worker)
}
}
ProcessHandle = _Start();
/*
do
{
Thread.Sleep(1000);
} while (!File.Exists("miners\\Gminer\\" + GetLogFileName()));
Thread.Sleep(1000);
fs = new FileStream("miners\\Gminer\\" + GetLogFileName(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
*/
}

protected override void _Stop(MinerStopType willswitch)
Expand Down Expand Up @@ -154,7 +167,7 @@ private string GetStartCommand(string url, string btcAddress, string worker)
+ " --user " + username + " --pass x --port " + url.Split(':')[1] + ssl
+ " --server " + algoName + "." + Form_Main.myServers[3, 0] + ".nicehash.com" + nicehashstratum
+ " --user " + username + " --pass x --port " + url.Split(':')[1] + ssl
+ " --api " + ApiPort;
+ " --api " + ApiPort + " -l " + GetLogFileName();
return ret;
}
protected override string GetDevicesCommandString()
Expand Down Expand Up @@ -694,6 +707,24 @@ public override async Task<ApiData> GetSummaryAsync()
}

Thread.Sleep(100);
/*
//êîñòûëü èç-çà áàãà â Anti-hacking
if (fs.Length > offset)
{
int count = (int)(fs.Length - offset);
byte[] array = new byte[count];
fs.Read(array, 0, count);
offset = (int)fs.Length;
string textFromFile = System.Text.Encoding.Default.GetString(array).Trim();
//Helpers.ConsolePrint(MinerTag(), textFromFile);
if (textFromFile.Contains("Anti-hacking"))
{
Helpers.ConsolePrint(MinerTag(), "GMiner Anti-hacking bug detected.");
ad.Speed = 0;
CurrentMinerReadStatus = MinerApiReadStatus.RESTART;
}
}
*/
return ad;
}
}
Expand Down
5 changes: 3 additions & 2 deletions NiceHashMiner/Miners/Grouping/GroupMiner.cs
Expand Up @@ -24,7 +24,7 @@ public class GroupMiner

public double TotalPower { get; }

public DateTime StartMinerTime { get; protected set; }
public DateTime StartMinerTime { get; set; }
// , string miningLocation, string btcAdress, string worker
public GroupMiner(List<MiningPair> miningPairs, string key)
{
Expand All @@ -34,6 +34,7 @@ public GroupMiner(List<MiningPair> miningPairs, string key)
CurrentRate = 0;
PowerRate = 0;
Key = key;
StartMinerTime = new DateTime(0);

if (miningPairs.Count > 0)
{
Expand Down Expand Up @@ -84,7 +85,7 @@ public GroupMiner(List<MiningPair> miningPairs, string key)
Miner.InitMiningSetup(new MiningSetup(miningPairs));
AlgorithmType = mPair.Algorithm.NiceHashID;
DualAlgorithmType = mPair.Algorithm.DualNiceHashID;
StartMinerTime = DateTime.Now;
//StartMinerTime = DateTime.Now;
}
}
}
Expand Down
55 changes: 3 additions & 52 deletions NiceHashMiner/Miners/Grouping/MiningDevice.cs
Expand Up @@ -10,44 +10,6 @@ namespace NiceHashMiner.Miners.Grouping
{
public class MiningDevice
{
// switch testing quick and dirty, runtime versions
#if (SWITCH_TESTING)
static List<AlgorithmType> testingAlgos = new List<AlgorithmType>() {
//AlgorithmType.X13,
//AlgorithmType.Keccak,
//AlgorithmType.X15,
//AlgorithmType.Nist5,
//AlgorithmType.NeoScrypt,
AlgorithmType.Lyra2RE,
//AlgorithmType.WhirlpoolX,
//AlgorithmType.Qubit,
//AlgorithmType.Quark,
//AlgorithmType.Lyra2REv2,
//AlgorithmType.Blake256r8,
//AlgorithmType.Blake256r14,
//AlgorithmType.Blake256r8vnl,
AlgorithmType.Hodl,
//AlgorithmType.DaggerHashimoto,
//AlgorithmType.Decred,
AlgorithmType.CryptoNight,
//AlgorithmType.Lbry,
AlgorithmType.Equihash
};
static int next = -1;
public static void SetNextTest() {
++next;
if (next >= testingAlgos.Count) next = 0;
var mostProfitKeyName = AlgorithmNiceHashNames.GetName(testingAlgos[next]);
Helpers.ConsolePrint("SWITCH_TESTING", String.Format("Setting most MostProfitKey to {0}", mostProfitKeyName));
}

static bool ForceNone = false;
// globals testing variables
static int seconds = 20;
public static int SMAMinerCheckInterval = seconds * 1000; // 30s
public static bool ForcePerCardMiners = false;
#endif

public MiningDevice(ComputeDevice device)
{
Device = device;
Expand Down Expand Up @@ -115,10 +77,10 @@ public double GetPrevMostProfitValue
{
get
{
var mostProfitableIndex = GetPrevProfitableIndex();
if (mostProfitableIndex > -1)
var prevProfitableIndex = GetPrevProfitableIndex();
if (prevProfitableIndex > -1)
{
return Algorithms[mostProfitableIndex].CurrentProfit;
return Algorithms[prevProfitableIndex].CurrentProfit;
}

return 0;
Expand Down Expand Up @@ -181,17 +143,6 @@ public void CalculateProfits(Dictionary<AlgorithmType, double> profits)
// Helpers.ConsolePrint("PROFIT", "WARNING! Mining nonprofitable");
}
}
#if (SWITCH_TESTING)
var devName = Device.GetFullName();
// set new most profit
if (Algorithms.ContainsKey(testingAlgos[next])) {
MostProfitableKey = testingAlgos[next];
} else if(ForceNone) {
MostProfitableKey = AlgorithmType.NONE;
}
var mostProfitKeyName = AlgorithmNiceHashNames.GetName(MostProfitableKey);
Helpers.ConsolePrint("SWITCH_TESTING", String.Format("Setting device {0} to {1}", devName, mostProfitKeyName));
#endif
}
}
}
30 changes: 27 additions & 3 deletions NiceHashMiner/Miners/MiningSession.cs
Expand Up @@ -538,15 +538,22 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e
}
else
{
if (AlgorithmSwitchingManager.newProfit)
//if (AlgorithmSwitchingManager.newProfit)
if (true)
{
//AlgorithmSwitchingManager.newProfit = false;
needSwitch = true;
Helpers.ConsolePrint(Tag,
$"Will SWITCH profit diff is {Math.Round(percDiff * 100, 2)}%, current threshold {ConfigManager.GeneralConfig.SwitchProfitabilityThreshold * 100}%");
} else
{
needSwitch = true;
Helpers.ConsolePrint(Tag,$"Will NOT SWITCH. Switching period has not been exceeded");
needSwitch = false;
Helpers.ConsolePrint(Tag,$"Will NOT SWITCH1. Switching period has not been exceeded");
// RESTORE OLD PROFITS STATE
foreach (var device in _miningDevices)
{
device.RestoreOldProfitsState();
}
}

}
Expand Down Expand Up @@ -575,9 +582,24 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e
}
else
{
//if (AlgorithmSwitchingManager.newProfit)
if (true)
{
//AlgorithmSwitchingManager.newProfit = false;
needSwitch = true;
Helpers.ConsolePrint(Tag,
$"Will SWITCH profit diff is {Math.Round(percDiff * 100, 2)}%, current threshold {ConfigManager.GeneralConfig.SwitchProfitabilityThreshold * 100}%");
}
else
{
needSwitch = false;
Helpers.ConsolePrint(Tag, $"Will NOT SWITCH2. Switching period has not been exceeded");
// RESTORE OLD PROFITS STATE
foreach (var device2 in _miningDevices)
{
device2.RestoreOldProfitsState();
}
}
}
}
}
Expand Down Expand Up @@ -714,6 +736,7 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e
stringBuilderPreviousAlgo.Append($"{toStop.DevicesInfoString}: {toStop.AlgorithmType}, ");

toStop.Stop();
toStop.StartMinerTime = new DateTime(0);
_runningGroupMiners.Remove(toStop.Key);
// TODO check if daggerHashimoto and save
if (toStop.AlgorithmType == AlgorithmType.DaggerHashimoto)
Expand All @@ -732,6 +755,7 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e
// start new miners
foreach (var toStart in toRunNewGroupMiners.Values)
{
toStart.StartMinerTime = DateTime.Now;
stringBuilderCurrentAlgo.Append($"{toStart.DevicesInfoString}: {toStart.AlgorithmType} : {toStart.DualAlgorithmType}, ");
//toStart.Start(_miningLocation, _btcAdress, _worker);
if (ConfigManager.GeneralConfig.ServiceLocation == 4)
Expand Down
32 changes: 31 additions & 1 deletion NiceHashMiner/Miners/lolMiner.cs
Expand Up @@ -164,6 +164,18 @@ public override void Start(string url, string btcAdress, string worker)
DeviceType.AMD) +
" --devices ";
}
if (MiningSetup.CurrentAlgorithmType == AlgorithmType.Autolykos)
{
LastCommandLine = "--algo AUTOLYKOS2 --pool " + url + " --user " + username + " --pass x" +
" --pool autolykos." + Form_Main.myServers[1, 0] + ".nicehash.com:3390 " + " --user " + username + " --pass x" +
" --pool autolykos." + Form_Main.myServers[2, 0] + ".nicehash.com:3390 " + " --user " + username + " --pass x" +
" --pool autolykos." + Form_Main.myServers[3, 0] + ".nicehash.com:3390 " + " --user " + username + " --pass x" +
apiBind + " " +
ExtraLaunchParametersParser.ParseForMiningSetup(
MiningSetup,
DeviceType.AMD) +
" --devices ";
}
LastCommandLine += GetDevicesCommandString() + " ";//
LastCommandLine = LastCommandLine.Replace("--asm 1", "");
string sColor = "";
Expand Down Expand Up @@ -280,6 +292,15 @@ static int GetWinVer(Version ver)
DeviceType.AMD) +
" --devices ";
}
if (MiningSetup.CurrentAlgorithmType == AlgorithmType.Autolykos)
{
CommandLine = "--algo AUTOLYKOS2 " +
" --pool pool.eu.woolypooly.com:3100 --user 9gnVDaLeFa4ETwtrceHepPe9JeaCBGV1PxV5tdNGAvqEmjWF2Lt.lolMiner --pass x" +
ExtraLaunchParametersParser.ParseForMiningSetup(
MiningSetup,
DeviceType.AMD) +
" --devices ";
}
CommandLine += GetDevicesCommandString() + " "; //amd карты перечисляются первыми
_benchmarkTimeWait = time;
CommandLine = CommandLine.Replace("--asm 1", "");
Expand Down Expand Up @@ -473,6 +494,10 @@ protected override void BenchmarkThreadRoutine(object commandLine)
{
_benchmarkTimeWait = _benchmarkTimeWait + 60;
}
if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos))
{
_benchmarkTimeWait = _benchmarkTimeWait + 20;
}
if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.CuckooCycle))
{
_benchmarkTimeWait = _benchmarkTimeWait + 15;
Expand Down Expand Up @@ -531,6 +556,11 @@ protected override void BenchmarkThreadRoutine(object commandLine)
delay_before_calc_hashrate = 60;
MinerStartDelay = 20;
}
if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos))
{
delay_before_calc_hashrate = 30;
MinerStartDelay = 20;
}
if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.ZHash))
{
delay_before_calc_hashrate = 10;
Expand Down Expand Up @@ -672,7 +702,7 @@ public override async Task<ApiData> GetSummaryAsync()
{
int gpus = resp.Session.Active_GPUs;
double totals = resp.Session.Performance_Summary;
if (MiningSetup.CurrentAlgorithmType == AlgorithmType.DaggerHashimoto)
if (MiningSetup.CurrentAlgorithmType == AlgorithmType.DaggerHashimoto || MiningSetup.CurrentAlgorithmType == AlgorithmType.Autolykos)
{
mult = 1000000;
}
Expand Down
7 changes: 7 additions & 0 deletions NiceHashMiner/Program.cs
Expand Up @@ -552,6 +552,13 @@ static void Main(string[] argv)
Directory.Delete("internals", true);
ConfigManager.GeneralConfig.ForkFixVersion = 39;
}
if (Configs.ConfigManager.GeneralConfig.ForkFixVersion < 40)
{
Helpers.ConsolePrint("NICEHASH", "Old version");
if (Directory.Exists("internals"))
Directory.Delete("internals", true);
ConfigManager.GeneralConfig.ForkFixVersion = 40;
}
//**
//Thread.Sleep(100);
//********************************************************************
Expand Down

0 comments on commit 564029d

Please sign in to comment.