From 46d3769a4474ef2c4c3c0f4ce55db72695b1d176 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 8 Sep 2020 20:13:16 +0200 Subject: [PATCH] Add peer to peer manager before fetching the tipset Signed-off-by: Jakub Sztandera --- node/hello/hello.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/node/hello/hello.go b/node/hello/hello.go index 1b03c5cdd1..05d53de06a 100644 --- a/node/hello/hello.go +++ b/node/hello/hello.go @@ -104,6 +104,10 @@ func (hs *Service) HandleStream(s inet.Stream) { build.Clock.Sleep(time.Millisecond * 300) } + if hs.pmgr != nil { + hs.pmgr.AddFilecoinPeer(s.Conn().RemotePeer()) + } + ts, err := hs.syncer.FetchTipSet(context.Background(), s.Conn().RemotePeer(), types.NewTipSetKey(hmsg.HeaviestTipSet...)) if err != nil { log.Errorf("failed to fetch tipset from peer during hello: %+v", err) @@ -117,9 +121,6 @@ func (hs *Service) HandleStream(s inet.Stream) { log.Infof("Got new tipset through Hello: %s from %s", ts.Cids(), s.Conn().RemotePeer()) hs.syncer.InformNewHead(s.Conn().RemotePeer(), ts) } - if hs.pmgr != nil { - hs.pmgr.AddFilecoinPeer(s.Conn().RemotePeer()) - } }