Skip to content

Commit

Permalink
Merge pull request #474 from ipfs-force-community/fix/check-peer-id
Browse files Browse the repository at this point in the history
fix: peer id is nil
  • Loading branch information
LinZexiao authored Oct 23, 2023
2 parents 9a8cf5d + 148bed9 commit ad8a50c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func (a *API) dealStarter(ctx context.Context, params *types.DealParams, isState
if err != nil {
return nil, fmt.Errorf("failed getting peer ID: %w", err)
}
if mi.PeerId == nil {
return nil, fmt.Errorf("miner %s has no peer id", params.Miner)
}

md, err := a.Full.StateMinerProvingDeadline(ctx, params.Miner, vTypes.EmptyTSK)
if err != nil {
Expand Down Expand Up @@ -529,6 +532,9 @@ func (a *API) ClientMinerQueryOffer(ctx context.Context, miner address.Address,
if err != nil {
return types.QueryOffer{}, err
}
if mi.PeerId == nil {
return types.QueryOffer{}, fmt.Errorf("miner %s has no peer id", miner)
}
rp := retrievalmarket.RetrievalPeer{
Address: miner,
ID: *mi.PeerId,
Expand Down Expand Up @@ -857,6 +863,9 @@ func (a *API) doRetrieval(ctx context.Context, order types.RetrievalOrder, sel d
if err != nil {
return 0, err
}
if mi.PeerId == nil {
return 0, fmt.Errorf("miner %s has no peer id", order.Miner)
}

order.MinerPeer = &retrievalmarket.RetrievalPeer{
ID: *mi.PeerId,
Expand Down

0 comments on commit ad8a50c

Please sign in to comment.