From ca3655a4094b4c70071c1901548fa90dfbd1adc7 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 20 Feb 2018 11:14:50 -0500 Subject: [PATCH] types: p2pID -> P2PID --- consensus/types/height_vote_set.go | 2 +- rpc/lib/client/http_client.go | 1 - types/vote_set.go | 12 ++++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go index 17ef334db..7db932045 100644 --- a/consensus/types/height_vote_set.go +++ b/consensus/types/height_vote_set.go @@ -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) } diff --git a/rpc/lib/client/http_client.go b/rpc/lib/client/http_client.go index b0bff02b9..902b7eebc 100644 --- a/rpc/lib/client/http_client.go +++ b/rpc/lib/client/http_client.go @@ -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 diff --git a/types/vote_set.go b/types/vote_set.go index 2d131e3c1..37f26f4a5 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -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") }