mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 21:36:26 +00:00
p2p: fix non-routable addr in test
This commit is contained in:
@@ -182,9 +182,19 @@ func TestPEXReactorAbuseFromPeer(t *testing.T) {
|
||||
assert.True(r.ReachedMaxMsgCountForPeer(peer.NodeInfo().ListenAddr))
|
||||
}
|
||||
|
||||
func createRoutableAddr() (addr string, netAddr *NetAddress) {
|
||||
for {
|
||||
addr = cmn.Fmt("%v.%v.%v.%v:46656", rand.Int()%256, rand.Int()%256, rand.Int()%256, rand.Int()%256)
|
||||
netAddr, _ = NewNetAddressString(addr)
|
||||
if netAddr.Routable() {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func createRandomPeer(outbound bool) *peer {
|
||||
addr := cmn.Fmt("%v.%v.%v.%v:46656", rand.Int()%256, rand.Int()%256, rand.Int()%256, rand.Int()%256)
|
||||
netAddr, _ := NewNetAddressString(addr)
|
||||
addr, netAddr := createRoutableAddr()
|
||||
p := &peer{
|
||||
key: cmn.RandStr(12),
|
||||
nodeInfo: &NodeInfo{
|
||||
|
||||
Reference in New Issue
Block a user