Skip to content

Commit

Permalink
Merge pull request #6807 from filecoin-project/nonsense/fetch-peerid-…
Browse files Browse the repository at this point in the history
…from-chain

ClientFindData: always fetch peer id from chain
  • Loading branch information
magik6k authored Jul 21, 2021
2 parents 2919547 + 9d0596e commit c29f375
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion node/impl/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,19 @@ func (a *API) ClientFindData(ctx context.Context, root cid.Cid, piece *cid.Cid)
if piece != nil && !piece.Equals(*p.PieceCID) {
continue
}
out = append(out, a.makeRetrievalQuery(ctx, p, root, piece, rm.QueryParams{}))

// do not rely on local data with respect to peer id
// fetch an up-to-date miner peer id from chain
mi, err := a.StateMinerInfo(ctx, p.Address, types.EmptyTSK)
if err != nil {
return nil, err
}
pp := rm.RetrievalPeer{
Address: p.Address,
ID: *mi.PeerId,
}

out = append(out, a.makeRetrievalQuery(ctx, pp, root, piece, rm.QueryParams{}))
}

return out, nil
Expand Down

0 comments on commit c29f375

Please sign in to comment.