- return false
- }
-
- return signNum > (numOfConsensusNode * 2 / 3)
-}
-
-// NextLeaderTime returns the start time of the specified public key as the next leader node
-func (b *bbft) NextLeaderTime(pubkey []byte, bestBlockTimestamp, bestBlockHeight uint64) (*time.Time, error) {
- return b.consensusNodeManager.nextLeaderTime(pubkey, bestBlockTimestamp, bestBlockHeight)
-}
-
-func (b *bbft) ApplyBlock(voteResultMap map[uint64]*state.VoteResult, block *types.Block) (err error) {
- voteSeq := block.Height / roundVoteBlockNums
- voteResult := voteResultMap[voteSeq]
-
- if voteResult == nil {
- store := b.consensusNodeManager.store
- voteResult, err = store.GetVoteResult(voteSeq)
- if err != nil && err != ErrNotFoundVoteResult {
- return err
- }
- }
-
- if voteResult == nil {
- voteResult = &state.VoteResult{
- Seq: voteSeq,
- NumOfVote: make(map[string]uint64),
- LastBlockHeight: block.Height,
- }
- }
-
- voteResultMap[voteSeq] = voteResult
-
- if voteResult.LastBlockHeight+1 != block.Height {
- return errors.New("bbft append block error, the block height is not equals last block height plus 1 of vote result")