Fix stmgr.GetMinerPeerID

This commit is contained in:
Łukasz Magiera 2019-09-17 10:34:41 +02:00
parent 5ea1459275
commit 8f84aa7097
3 changed files with 9 additions and 8 deletions

View File

@ -110,7 +110,7 @@ func GetMinerPeerID(ctx context.Context, sm *StateManager, ts *types.TipSet, mad
recp, err := sm.Call(ctx, &types.Message{ recp, err := sm.Call(ctx, &types.Message{
To: maddr, To: maddr,
From: maddr, From: maddr,
Method: actors.MAMethods.GetWorkerAddr, Method: actors.MAMethods.GetPeerID,
}, ts) }, ts)
if err != nil { if err != nil {
return "", xerrors.Errorf("callRaw failed: %w", err) return "", xerrors.Errorf("callRaw failed: %w", err)

View File

@ -3,6 +3,7 @@ package client
import ( import (
"context" "context"
"errors" "errors"
"golang.org/x/xerrors"
"os" "os"
"github.com/ipfs/go-blockservice" "github.com/ipfs/go-blockservice"
@ -258,7 +259,7 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
err = a.Retrieval.RetrieveUnixfs(ctx, order.Root, order.Size, order.Total, order.MinerPeerID, order.Client, order.Miner, outFile) err = a.Retrieval.RetrieveUnixfs(ctx, order.Root, order.Size, order.Total, order.MinerPeerID, order.Client, order.Miner, outFile)
if err != nil { if err != nil {
_ = outFile.Close() _ = outFile.Close()
return err return xerrors.Errorf("RetrieveUnixfs: %w", err)
} }
return outFile.Close() return outFile.Close()

View File

@ -117,11 +117,11 @@ func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64,
paych, _, err := c.pmgr.GetPaych(ctx, client, minerAddr, total) paych, _, err := c.pmgr.GetPaych(ctx, client, minerAddr, total)
if err != nil { if err != nil {
return err return xerrors.Errorf("getting payment channel: %w", err)
} }
lane, err := c.pmgr.AllocateLane(paych) lane, err := c.pmgr.AllocateLane(paych)
if err != nil { if err != nil {
return err return xerrors.Errorf("allocating payment lane: %w", err)
} }
cst := clientStream{ cst := clientStream{
@ -150,7 +150,7 @@ func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64,
err := cst.doOneExchange(ctx, toFetch, out) err := cst.doOneExchange(ctx, toFetch, out)
if err != nil { if err != nil {
return err return xerrors.Errorf("retrieval exchange: %w", err)
} }
cst.offset += toFetch cst.offset += toFetch
@ -164,7 +164,7 @@ func (cst *clientStream) doOneExchange(ctx context.Context, toFetch uint64, out
payment, err := cst.setupPayment(ctx, payAmount) payment, err := cst.setupPayment(ctx, payAmount)
if err != nil { if err != nil {
return err return xerrors.Errorf("setting up retrieval payment: %w", err)
} }
deal := DealProposal{ deal := DealProposal{
@ -216,12 +216,12 @@ func (cst *clientStream) fetchBlocks(toFetch uint64, out io.Writer) error {
var block Block var block Block
if err := cborrpc.ReadCborRPC(cst.stream, &block); err != nil { if err := cborrpc.ReadCborRPC(cst.stream, &block); err != nil {
return err return xerrors.Errorf("reading fetchBlock response: %w", err)
} }
dataBlocks, err := cst.consumeBlockMessage(block, out) dataBlocks, err := cst.consumeBlockMessage(block, out)
if err != nil { if err != nil {
return err return xerrors.Errorf("consuming retrieved blocks: %w", err)
} }
i += dataBlocks i += dataBlocks