Skip to content

Commit

Permalink
Merge pull request #3667 from filecoin-project/fix/new-ts
Browse files Browse the repository at this point in the history
Add peer to peer manager before fetching the tipset
  • Loading branch information
magik6k committed Sep 8, 2020
2 parents 1ef0359 + 46d3769 commit b1d251e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions node/hello/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())
}

}

Expand Down

0 comments on commit b1d251e

Please sign in to comment.