Ejemplo n.º 1
0
        public void StopMining(bool result, string startId)
        {
            var stopMsg = StopMiningMsg.CreateNew();

            stopMsg.StopTime = Time.EpochTime;
            var block = RedisManager.Current.GetDataInRedis <BlockMsg>(startId);

            stopMsg.CurrentHeight = Convert.ToInt32(block.Header.Height);
            stopMsg.StartMsgId    = startId;
            if (result)
            {
                stopMsg.StopReason = StopReason.MiningSucesses;
                _generatedBlockCount++;
            }
            else
            {
                stopMsg.StopReason = StopReason.IsMininged;
            }
            //MQApi.SendStopMsg(stopMsg);
            RabbitMQApi.SendStopMsg(stopMsg);
            if (!RemoveStartMsgIds.ContainsKey(stopMsg.StartMsgId))
            {
                RemoveStartMsgIds.Add(stopMsg.StartMsgId, stopMsg.StopTime);
            }
        }
Ejemplo n.º 2
0
        public static void SendStopMsg(StopMiningMsg stopMsg)
        {
            string json = JsonConvert.SerializeObject(stopMsg);

            RabbitMqClient.Current.ProduceMessage(RabbitMqName.StopMining, MsgType.StopMining, json);
        }