Merge pull request #3667 from filecoin-project/fix/new-ts

Add peer to peer manager before fetching the tipset
This commit is contained in:
Łukasz Magiera 2020-09-08 22:54:51 +02:00 committed by GitHub
commit b1d251e950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,6 +104,10 @@ func (hs *Service) HandleStream(s inet.Stream) {
build.Clock.Sleep(time.Millisecond * 300) 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...)) ts, err := hs.syncer.FetchTipSet(context.Background(), s.Conn().RemotePeer(), types.NewTipSetKey(hmsg.HeaviestTipSet...))
if err != nil { if err != nil {
log.Errorf("failed to fetch tipset from peer during hello: %+v", err) 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()) log.Infof("Got new tipset through Hello: %s from %s", ts.Cids(), s.Conn().RemotePeer())
hs.syncer.InformNewHead(s.Conn().RemotePeer(), ts) hs.syncer.InformNewHead(s.Conn().RemotePeer(), ts)
} }
if hs.pmgr != nil {
hs.pmgr.AddFilecoinPeer(s.Conn().RemotePeer())
}
} }