diff --git a/cmd/daemon.go b/cmd/daemon.go index 4d757cfea..9a281f1f1 100644 --- a/cmd/daemon.go +++ b/cmd/daemon.go @@ -132,13 +132,15 @@ func daemon() { // If seedNode is provided by config, dial out. if config.App.GetString("SeedNode") != "" { - peer, err := n.sw.DialPeerWithAddress(p2p.NewNetAddressString(config.App.GetString("SeedNode"))) + addr := p2p.NewNetAddressString(config.App.GetString("SeedNode")) + peer, err := n.sw.DialPeerWithAddress(addr) if err != nil { log.Error("Error dialing seed", "error", err) //n.book.MarkAttempt(addr) return } else { log.Info("Connected to seed", "peer", peer) + n.book.AddAddress(addr, addr) } } diff --git a/p2p/pex_reactor.go b/p2p/pex_reactor.go index 3c28f8b68..2a018d07b 100644 --- a/p2p/pex_reactor.go +++ b/p2p/pex_reactor.go @@ -152,6 +152,7 @@ FOR_LOOP: func (pexR *PEXReactor) ensurePeers() { numOutPeers, _, numDialing := pexR.sw.NumPeers() numToDial := minNumOutboundPeers - (numOutPeers + numDialing) + log.Info("Ensure peers", "numOutPeers", numOutPeers, "numDialing", numDialing, "numToDial", numToDial) if numToDial <= 0 { return } @@ -164,7 +165,7 @@ func (pexR *PEXReactor) ensurePeers() { var picked *NetAddress // Try to fetch a new peer 3 times. // This caps the maximum number of tries to 3 * numToDial. - for j := 0; i < 3; j++ { + for j := 0; j < 3; j++ { picked = pexR.book.PickAddress(newBias) if picked == nil { return