|
|
@ -11,7 +11,11 @@ import ( |
|
|
|
cmn "github.com/tendermint/tmlibs/common" |
|
|
|
) |
|
|
|
|
|
|
|
type p2pID string |
|
|
|
// UNSTABLE
|
|
|
|
// XXX: duplicate of p2p.ID to avoid dependence between packages.
|
|
|
|
// Perhaps we can have a minimal types package containing this (and other things?)
|
|
|
|
// that both `types` and `p2p` import ?
|
|
|
|
type P2PID string |
|
|
|
|
|
|
|
/* |
|
|
|
VoteSet helps collect signatures from validators at each height+round for a |
|
|
@ -60,7 +64,7 @@ type VoteSet struct { |
|
|
|
sum int64 // Sum of voting power for seen votes, discounting conflicts
|
|
|
|
maj23 *BlockID // First 2/3 majority seen
|
|
|
|
votesByBlock map[string]*blockVotes // string(blockHash|blockParts) -> blockVotes
|
|
|
|
peerMaj23s map[p2pID]BlockID // Maj23 for each peer
|
|
|
|
peerMaj23s map[P2PID]BlockID // Maj23 for each peer
|
|
|
|
} |
|
|
|
|
|
|
|
// Constructs a new VoteSet struct used to accumulate votes for given height/round.
|
|
|
@ -79,7 +83,7 @@ func NewVoteSet(chainID string, height int64, round int, type_ byte, valSet *Val |
|
|
|
sum: 0, |
|
|
|
maj23: nil, |
|
|
|
votesByBlock: make(map[string]*blockVotes, valSet.Size()), |
|
|
|
peerMaj23s: make(map[p2pID]BlockID), |
|
|
|
peerMaj23s: make(map[P2PID]BlockID), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -292,7 +296,7 @@ func (voteSet *VoteSet) addVerifiedVote(vote *Vote, blockKey string, votingPower |
|
|
|
// this can cause memory issues.
|
|
|
|
// TODO: implement ability to remove peers too
|
|
|
|
// NOTE: VoteSet must not be nil
|
|
|
|
func (voteSet *VoteSet) SetPeerMaj23(peerID p2pID, blockID BlockID) error { |
|
|
|
func (voteSet *VoteSet) SetPeerMaj23(peerID P2PID, blockID BlockID) error { |
|
|
|
if voteSet == nil { |
|
|
|
cmn.PanicSanity("SetPeerMaj23() on nil VoteSet") |
|
|
|
} |
|
|
|