From a6914309a60671f8688aee55403fe233a7ec34f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 28 Aug 2019 23:11:29 +0200 Subject: [PATCH] retrieval: 'fix' GetPIP in handler --- chain/deals/handler_states.go | 3 ++- retrieval/client.go | 1 + retrieval/verify.go | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/chain/deals/handler_states.go b/chain/deals/handler_states.go index c84320fb1..8e5e07a26 100644 --- a/chain/deals/handler_states.go +++ b/chain/deals/handler_states.go @@ -134,7 +134,8 @@ func (h *Handler) sealing(ctx context.Context, deal MinerDeal) (func(*MinerDeal) return nil, err } - ip, err := getInclusionProof(deal.Ref.String(), status) + // TODO: don't hardcode unixfs + ip, err := getInclusionProof(string(sectorblocks.SerializationUnixfs0) + deal.Ref.String(), status) if err != nil { return nil, err } diff --git a/retrieval/client.go b/retrieval/client.go index baaca9d5d..1e51aaa00 100644 --- a/retrieval/client.go +++ b/retrieval/client.go @@ -212,6 +212,7 @@ func (cst *clientStream) consumeBlockMessage(pb pb.Message_Block, out io.Writer) internal, err := cst.verifier.Verify(context.TODO(), blk, out) if err != nil { + log.Warnf("block verify failed: %s", err) return 0, err } diff --git a/retrieval/verify.go b/retrieval/verify.go index e232a06ac..f17f58a55 100644 --- a/retrieval/verify.go +++ b/retrieval/verify.go @@ -86,14 +86,16 @@ func (b *UnixFs0Verifier) verify(ctx context.Context, blk blocks.Block, out io.W func (b *UnixFs0Verifier) checkInternal(blk blocks.Block, out io.Writer) (int, error) { nd, err := ipld.Decode(blk) if err != nil { + log.Warnf("IPLD Decode failed: %s", err) return 0, err } // TODO: check size - switch nd.(type) { + switch nd := nd.(type) { case *merkledag.ProtoNode: - fsn, err := unixfs.FSNodeFromBytes(nd.RawData()) + fsn, err := unixfs.FSNodeFromBytes(nd.Data()) if err != nil { + log.Warnf("unixfs.FSNodeFromBytes failed: %s", err) return 0, err } if fsn.Type() != pb.Data_File {