diff --git a/consensus/consensus_service.go b/consensus/consensus_service.go index 17a220de0..ffbb2f370 100644 --- a/consensus/consensus_service.go +++ b/consensus/consensus_service.go @@ -573,9 +573,9 @@ func (consensus *Consensus) selfCommit(payload []byte) error { continue } - if _, err := consensus.Decider.SubmitVote( + if _, err := consensus.Decider.AddNewVote( quorum.Commit, - []bls.SerializedPublicKey{key.Pub.Bytes}, + []*bls_cosi.PublicKeyWrapper{key.Pub}, key.Pri.SignHash(commitPayload), common.BytesToHash(consensus.blockHash[:]), block.NumberU64(), diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 6360d77a0..ea1d1b9a0 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -517,7 +517,7 @@ func (consensus *Consensus) commitBlock(blk *types.Block, committedMsg *FBFTMess } atomic.AddUint64(&consensus.blockNum, 1) - consensus.SetCurBlockViewID(committedMsg.ViewID + 1) + consensus.SetViewIDs(committedMsg.ViewID + 1) consensus.LeaderPubKey = committedMsg.SenderPubkeys[0] // Update consensus keys at last so the change of leader status doesn't mess up normal flow if blk.IsLastBlockInEpoch() { diff --git a/consensus/view_change.go b/consensus/view_change.go index 37df69712..2603f0e53 100644 --- a/consensus/view_change.go +++ b/consensus/view_change.go @@ -131,9 +131,8 @@ func (consensus *Consensus) getNextViewID() (uint64, time.Duration) { if curTimestamp <= blockTimestamp { return consensus.fallbackNextViewID() } - totalNode := consensus.Decider.ParticipantsCount() // diff is at least 1, and it won't exceed the totalNode - diff := uint64(((curTimestamp - blockTimestamp) / viewChangeTimeout) % int64(totalNode)) + diff := uint64((curTimestamp - blockTimestamp) / viewChangeTimeout) nextViewID := diff + consensus.GetCurBlockViewID() consensus.getLogger().Info().