private static void RunMiner() { try { Task.Run(() => { gc = new GrinConeeect(Config.GGMC); if (!gc.IsConnected) { Logger.PushError("Unable to connect to node."); return; } Parallel.ForEach(Config.GGMC.GPUs, (gpu) => { gpu.Driver = new TrimDriver(gpu); }); }); UI.StartUI(); } catch (Exception ex) { Logger.Log(LogType.FatalError, "Fatal error.", ex); } }
private void TrimmingLoop() { while (!Calcelled) { GrinConeeect conn = GetCurrentConn(); if (conn.lastComm.AddMinutes(30) < DateTime.Now) { conn.WaitForJob = true; } if (conn.WaitForJob | !conn.IsConnected) { Task.Delay(100).Wait(); Console.Write("."); continue; } JobTemplate job = conn.CurrentJob; UInt64 hnonce = (UInt64)(long)rnd.Next() | ((UInt64)(long)rnd.Next() << 32); var bytes = BitConverter.GetBytes(hnonce).Reverse().ToArray(); header = header.Concat(bytes).ToArray(); var hash = new Crypto.Blake2B(256); byte[] blaked = hash.ComputeHash(header); //blaked = hash.ComputeHash(blaked); -- testnet2 bug k0 = BitConverter.ToUInt64(blaked, 0); k1 = BitConverter.ToUInt64(blaked, 8); k2 = BitConverter.ToUInt64(blaked, 16); k3 = BitConverter.ToUInt64(blaked, 24); } }