Esempio n. 1
0
        /// <summary>
        /// Sends a mining-job to miner.
        /// </summary>
        public void SendJob(IJob job)
        {
            var notification = new StratumJsonRequest
            {
                Id     = null,
                Method = "mining.notify",
                Params = job,
                Error  = null
            };

            Send(notification);
        }
Esempio n. 2
0
        /// <summary>
        /// Sends message of the day to miner.
        /// </summary>
        public void SendMessage(string message)
        {
            var notification = new StratumJsonRequest
            {
                Id     = null,
                Method = "client.show_message",
                Params = new List <object> {
                    message
                },
                Error = null
            };

            Send(notification);
        }
Esempio n. 3
0
        /// <summary>
        /// Sets a new difficulty to the miner and sends it.
        /// </summary>
        public void SetDifficulty(float difficulty)
        {
            if (Difficulty == difficulty)    // if new difficulty is the same with current one,
            {
                return;                      // just skip.
            }
            PreviousDifficulty = Difficulty; // store the previous difficulty (so we can still accept shares targeted for last difficulty when vardiff sets a new difficulty).
            Difficulty         = difficulty;

            var notification = new StratumJsonRequest
            {
                Id     = null,
                Method = "mining.set_difficulty",
                Params = new List <object> {
                    Difficulty
                },
                Error = null
            };

            Send(notification);                   //send the difficulty update message.
            _storageLayer.UpdateDifficulty(this); // store the new difficulty within persistance layer.
        }