Beispiel #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);
            }
        }
Beispiel #2
0
        private static void Start(PoolArgs args)
        {
            try
            {
                //MQApi.SendStopMsg(new ShareModels.Msgs.StopMiningMsg { StopReason = StopReason.ReStart });
                RabbitMQApi.SendStopMsg(new ShareModels.Msgs.StopMiningMsg {
                    StopReason = StopReason.ReStart
                });
                PoolCenterJob.Current = new PoolCenterJob(args);
                PoolCenterJob.Current.Start();
                PoolCenterJob.Current.StartListen();
                LogHelper.Info("OmniCoin PoolCenter Start !!!");

                TimerTasks.Current.Init();
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.ToString());
            }
        }