func (voteSet *VoteSet) AddVote(vote *Vote) (added bool, err error) {
	if voteSet == nil {
		panic("AddVote() on nil VoteSet")
	}
	voteSet.mtx.Lock()
	defer voteSet.mtx.Unlock()
	return voteSet.addVote(vote)
}
Returns added=true if vote is valid and new.
Otherwise returns err=ErrVote[
UnexpectedStep | InvalidIndex | InvalidAddress |
InvalidSignature | InvalidBlockHash | ConflictingVotes ]
Duplicate votes return added=false, err=nil.
Conflicting votes return added=*, err=ErrVoteConflictingVotes.
NOTE: vote should not be mutated after adding.
NOTE: VoteSet must not be nil
NOTE: Vote must not be nil
package types
import (
	"bytes"
	"fmt"
	"strings"
	tmsync "github.com/tendermint/tendermint/internal/libs/sync"
	"github.com/tendermint/tendermint/libs/bits"
	tmjson "github.com/tendermint/tendermint/libs/json"
	tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)
const (
	MaxVotesCount = 10000
)
type P2PID string
type VoteSet struct {
	chainID       string
	height        int64
	round         int32
	signedMsgType tmproto.SignedMsgType
	valSet        *ValidatorSet
	mtx           tmsync.Mutex
	votesBitArray *bits.BitArray
	votes         []*Vote                 
	sum           int64                   
	maj23         *BlockID                
	votesByBlock  map[string]*blockVotes  
	peerMaj23s    map[P2PID]BlockID       
}
func NewVoteSet(chainID string, height int64, round int32,
	signedMsgType tmproto.SignedMsgType, valSet *ValidatorSet) *VoteSet {
	if height == 0 {
		panic("Cannot make VoteSet for height == 0, doesn't make sense.")
	}
	return &VoteSet{
		chainID:       chainID,
		height:        height,
		round:         round,
		signedMsgType: signedMsgType,
		valSet:        valSet,
		votesBitArray: bits.NewBitArray(valSet.Size()),
		votes:         make([]*Vote, valSet.Size()),
		sum:           0,
		maj23:         nil,
		votesByBlock:  make(map[string]*blockVotes, valSet.Size()),
		peerMaj23s:    make(map[P2PID]BlockID),
	}
}
func (voteSet *VoteSet) ChainID() string {
	return voteSet.chainID
}
func (voteSet *VoteSet) GetHeight() int64 {
	if voteSet == nil {
		return 0
	}
	return voteSet.height
}
func (voteSet *VoteSet) GetRound() int32 {
	if voteSet == nil {
		return -1
	}
	return voteSet.round
}
func (voteSet *VoteSet) Type() byte {
	if voteSet == nil {
		return 0x00
	}
	return byte(voteSet.signedMsgType)
}
func (voteSet *VoteSet) Size() int {
	if voteSet == nil {
		return 0
	}
	return voteSet.valSet.Size()
}