retrieval: 'fix' GetPIP in handler

This commit is contained in:
Łukasz Magiera 2019-08-28 23:11:29 +02:00
parent e28c0c8d80
commit a6914309a6
3 changed files with 7 additions and 3 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {