Browse Source

types: p2pID -> P2PID

pull/1265/head
Ethan Buchman 6 years ago
parent
commit
ca3655a409
3 changed files with 9 additions and 6 deletions
  1. +1
    -1
      consensus/types/height_vote_set.go
  2. +0
    -1
      rpc/lib/client/http_client.go
  3. +8
    -4
      types/vote_set.go

+ 1
- 1
consensus/types/height_vote_set.go View File

@ -218,5 +218,5 @@ func (hvs *HeightVoteSet) SetPeerMaj23(round int, type_ byte, peerID p2p.ID, blo
if voteSet == nil {
return nil // something we don't know about yet
}
return voteSet.SetPeerMaj23(peerID, blockID)
return voteSet.SetPeerMaj23(types.P2PID(peerID), blockID)
}

+ 0
- 1
rpc/lib/client/http_client.go View File

@ -187,7 +187,6 @@ func argsToJson(args map[string]interface{}) error {
continue
}
// Pass everything else to go-wire
data, err := json.Marshal(v)
if err != nil {
return err


+ 8
- 4
types/vote_set.go View File

@ -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")
}


Loading…
Cancel
Save