p2p: tmconn->conn and types->p2p

This commit is contained in:
Ethan Buchman
2018-01-21 00:33:53 -05:00
parent 0d7d16005a
commit 44e967184a
28 changed files with 160 additions and 177 deletions

View File

@ -8,14 +8,13 @@ import (
"github.com/stretchr/testify/assert"
crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/tendermint/p2p/types"
cmn "github.com/tendermint/tmlibs/common"
)
// Returns an empty dummy peer
func randPeer() *peer {
return &peer{
nodeInfo: types.NodeInfo{
nodeInfo: NodeInfo{
ListenAddr: cmn.Fmt("%v.%v.%v.%v:46656", rand.Int()%256, rand.Int()%256, rand.Int()%256, rand.Int()%256),
PubKey: crypto.GenPrivKeyEd25519().Wrap().PubKey(),
},
@ -120,7 +119,7 @@ func TestPeerSetAddDuplicate(t *testing.T) {
// Our next procedure is to ensure that only one addition
// succeeded and that the rest are each ErrSwitchDuplicatePeer.
wantErrCount, gotErrCount := n-1, errsTally[types.ErrSwitchDuplicatePeer]
wantErrCount, gotErrCount := n-1, errsTally[ErrSwitchDuplicatePeer]
assert.Equal(t, wantErrCount, gotErrCount, "invalid ErrSwitchDuplicatePeer count")
wantNilErrCount, gotNilErrCount := 1, errsTally[nil]