|
|
|
@ -164,7 +164,7 @@ func (consensus *Consensus) onPrepare(msg *msg_pb.Message) { |
|
|
|
|
logger = logger.With(). |
|
|
|
|
Int64("NumReceivedSoFar", consensus.Decider.SignersCount(quorum.Prepare)). |
|
|
|
|
Int64("PublicKeys", consensus.Decider.ParticipantsCount()).Logger() |
|
|
|
|
logger.Info().Msg("[OnPrepare] Received New Prepare Signature") |
|
|
|
|
logger.Debug().Msg("[OnPrepare] Received New Prepare Signature") |
|
|
|
|
if _, err := consensus.Decider.SubmitVote( |
|
|
|
|
quorum.Prepare, validatorPubKey, |
|
|
|
|
&sign, recvMsg.BlockHash, |
|
|
|
@ -224,7 +224,7 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) { |
|
|
|
|
// Must have the corresponding block to verify committed message.
|
|
|
|
|
blockObj := consensus.FBFTLog.GetBlockByHash(recvMsg.BlockHash) |
|
|
|
|
if blockObj == nil { |
|
|
|
|
consensus.getLogger().Debug(). |
|
|
|
|
consensus.getLogger().Info(). |
|
|
|
|
Uint64("blockNum", recvMsg.BlockNum). |
|
|
|
|
Uint64("viewID", recvMsg.ViewID). |
|
|
|
|
Str("blockHash", recvMsg.BlockHash.Hex()). |
|
|
|
@ -246,7 +246,7 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) { |
|
|
|
|
logger = logger.With(). |
|
|
|
|
Int64("numReceivedSoFar", consensus.Decider.SignersCount(quorum.Commit)). |
|
|
|
|
Logger() |
|
|
|
|
logger.Info().Msg("[OnCommit] Received new commit message") |
|
|
|
|
logger.Debug().Msg("[OnCommit] Received new commit message") |
|
|
|
|
|
|
|
|
|
if _, err := consensus.Decider.SubmitVote( |
|
|
|
|
quorum.Commit, validatorPubKey, |
|
|
|
@ -267,9 +267,12 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) { |
|
|
|
|
quorumIsMet := consensus.Decider.IsQuorumAchieved(quorum.Commit) |
|
|
|
|
if !quorumWasMet && quorumIsMet { |
|
|
|
|
logger.Info().Msg("[OnCommit] 2/3 Enough commits received") |
|
|
|
|
|
|
|
|
|
next := consensus.NextBlockDue |
|
|
|
|
consensus.getLogger().Info().Msg("[OnCommit] Starting Grace Period") |
|
|
|
|
time.AfterFunc(2*time.Second, func() { |
|
|
|
|
<-time.After(time.Until(next)) |
|
|
|
|
logger.Info().Msg("[OnCommit] Commit Grace Period Ended") |
|
|
|
|
consensus.commitFinishChan <- viewID |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|