From 0c6e0fc58da78c378c32bb9ded2dd04ad5e754a9 Mon Sep 17 00:00:00 2001 From: Mehmet Gurevin Date: Thu, 8 Nov 2018 18:01:58 +0300 Subject: [PATCH] preserve dial to itself --- p2p/pex/pex_reactor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/p2p/pex/pex_reactor.go b/p2p/pex/pex_reactor.go index 46a12c488..e7c300e42 100644 --- a/p2p/pex/pex_reactor.go +++ b/p2p/pex/pex_reactor.go @@ -8,7 +8,6 @@ import ( "time" "github.com/pkg/errors" - amino "github.com/tendermint/go-amino" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/p2p" @@ -411,6 +410,10 @@ func (r *PEXReactor) ensurePeers() { if r.Switch.IsDialingOrExistingAddress(try) { continue } + if r.Switch.NodeInfo().ID() == try.ID { + continue // we don't want to dial ourselves, usually. + } + // TODO: consider moving some checks from toDial into here // so we don't even consider dialing peers that we want to wait // before dialling again, or have dialed too many times already