Пример #1
0
 public void AddCommitedResult(AuthorizerCommitMsg msg)
 {
     CommitMsgs.Add(msg);
     if (CommitMsgs.Count() >= ProtocolSettings.Default.ConsensusNumber)
     {
         Settled = true;
         Done.Set();
     }
 }
Пример #2
0
        public bool AddCommitedResult(AuthorizerCommitMsg msg)
        {
            //_log.LogInformation($"Commit msg from: {msg.From.Shorten()}");
            // check repeated message
            if (CommitMsgs.ToList().Any(a => a.From == msg.From))
            {
                return(false);
            }

            // check network state
            // !! only accept from svcBlock ( or associated view )
            // check for valid validators
            if (!CheckSenderValid(msg.From))
            {
                return(false);
            }

            CommitMsgs.Add(msg);

            return(true);
        }
Пример #3
0
        public bool AddCommitedResult(AuthorizerCommitMsg msg)
        {
            _log.LogInformation($"Commit msg from: {msg.From}");
            // check repeated message
            if (CommitMsgs.ToList().Any(a => a.From == msg.From))
            {
                return(false);
            }

            CommitMsgs.Add(msg);

            var CommitMsgList = CommitMsgs.ToList();

            if (CommitMsgList.Count(a => a.Consensus == ConsensusResult.Yay) >= ProtocolSettings.Default.ConsensusWinNumber ||
                CommitMsgList.Count(a => a.Consensus == ConsensusResult.Nay) >= ProtocolSettings.Default.ConsensusWinNumber)
            {
                _log.LogInformation($"Committed: {ConsensusUIndex}/{InputMsg.Block.Index} Yay: {CommitMsgs.Count(a => a.Consensus == ConsensusResult.Yay)} of {CommitMsgs.Select(a => a.From.Shorten()).Aggregate((x, y) => x + ", " + y)}");
                Settled = true;
                Done.Set();
            }
            return(true);
        }