From 8f84aa70975e6e13befc4ee642876f37014d98f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 17 Sep 2019 10:34:41 +0200 Subject: [PATCH] Fix stmgr.GetMinerPeerID --- chain/stmgr/utils.go | 2 +- node/impl/client/client.go | 3 ++- retrieval/client.go | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 24b8909ae..da3f9e02d 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -110,7 +110,7 @@ func GetMinerPeerID(ctx context.Context, sm *StateManager, ts *types.TipSet, mad recp, err := sm.Call(ctx, &types.Message{ To: maddr, From: maddr, - Method: actors.MAMethods.GetWorkerAddr, + Method: actors.MAMethods.GetPeerID, }, ts) if err != nil { return "", xerrors.Errorf("callRaw failed: %w", err) diff --git a/node/impl/client/client.go b/node/impl/client/client.go index cefc25797..e03cda45d 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -3,6 +3,7 @@ package client import ( "context" "errors" + "golang.org/x/xerrors" "os" "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) if err != nil { _ = outFile.Close() - return err + return xerrors.Errorf("RetrieveUnixfs: %w", err) } return outFile.Close() diff --git a/retrieval/client.go b/retrieval/client.go index 47ed70cbc..611cad012 100644 --- a/retrieval/client.go +++ b/retrieval/client.go @@ -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) if err != nil { - return err + return xerrors.Errorf("getting payment channel: %w", err) } lane, err := c.pmgr.AllocateLane(paych) if err != nil { - return err + return xerrors.Errorf("allocating payment lane: %w", err) } cst := clientStream{ @@ -150,7 +150,7 @@ func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64, err := cst.doOneExchange(ctx, toFetch, out) if err != nil { - return err + return xerrors.Errorf("retrieval exchange: %w", err) } cst.offset += toFetch @@ -164,7 +164,7 @@ func (cst *clientStream) doOneExchange(ctx context.Context, toFetch uint64, out payment, err := cst.setupPayment(ctx, payAmount) if err != nil { - return err + return xerrors.Errorf("setting up retrieval payment: %w", err) } deal := DealProposal{ @@ -216,12 +216,12 @@ func (cst *clientStream) fetchBlocks(toFetch uint64, out io.Writer) error { var block Block 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) if err != nil { - return err + return xerrors.Errorf("consuming retrieved blocks: %w", err) } i += dataBlocks