Exemplo n.º 1
0
        public StratumRpcRequest(StratumCommand cmd)
        {
            switch (cmd)
            {
            case StratumCommand.Status:
                method = "status";
                break;

            case StratumCommand.Solution:
                method = "submit";
                break;

            case StratumCommand.Login:
                method = "login";
                break;

            case StratumCommand.GetJob:
                method = "getjobtemplate";
                break;

            case StratumCommand.Keepalive:
                method = "keepalive";
                break;
            }
        }
Exemplo n.º 2
0
        static void stratum_GotSetDifficulty(object sender, StratumEventArgs e)
        {
            StratumCommand Command = (StratumCommand)e.MiningEventArg;

            //Vagabondan 2017-07-26: difficulty type should be modified!
            Console.WriteLine("Program.stratum_GotSetDifficulty: this should be MODIFIED!!! CurrentDiffficulty should not be integer!");
            CurrentDifficulty = Convert.ToInt32(Command.Parameters[0]);

            Console.WriteLine("Got Set_Difficulty " + CurrentDifficulty);
        }
Exemplo n.º 3
0
        static void stratum_GotNotify(object sender, StratumEventArgs e)
        {
            Job            ThisJob = new Job();
            StratumCommand Command = (StratumCommand)e.MiningEventArg;

            ThisJob.JobID        = (string)Command.Parameters[0];
            ThisJob.PreviousHash = (string)Command.Parameters[1];
            ThisJob.Coinb1       = (string)Command.Parameters[2];
            ThisJob.Coinb2       = (string)Command.Parameters[3];
            Array a = (Array)Command.Parameters[4];

            ThisJob.Version           = (string)Command.Parameters[5];
            ThisJob.NetworkDifficulty = (string)Command.Parameters[6];
            ThisJob.NetworkTime       = (string)Command.Parameters[7];
            ThisJob.CleanJobs         = (bool)Command.Parameters[8];

            ThisJob.MerkleNumbers = new string[a.Length];

            int i = 0;

            foreach (string s in a)
            {
                ThisJob.MerkleNumbers[i++] = s;
            }

            // Cancel the existing mining threads and clear the queue if CleanJobs = true
            if (ThisJob.CleanJobs)
            {
                Console.WriteLine("Stratum detected a new block. Stopping old threads.");

                IncomingJobs.Clear();
                //CoinMiner.done = true;
            }

            // Add the new job to the queue
            IncomingJobs.Enqueue(ThisJob);
        }
Exemplo n.º 4
0
 public StratumRpcRequest(StratumCommand cmd) => Method = cmd.ToString();