Пример #1
0
        /// <summary>
        /// 成为候选人
        /// </summary>
        /// <param name="state"></param>
        public void BecomeCandidate(CurrentState state)
        {
            TxPool.StopCacheTx();
            _logger.LogInformation($"{state.Id} became candidate");
            Candidate candidata = null;

            candidata = _stateprovider.GetCandidate(state);// new Candidate(state, _fsm, _getPeers(state), _log, _random, this, _settings, _rules, _loggerFactory);
            State     = candidata;
            //开始选举
            candidata.BeginElectionAsync().Wait();
        }