Commit f819c6c5 authored by Jeromy's avatar Jeromy

fix blockservice error ignorance

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 75d6f9ce
......@@ -96,19 +96,25 @@ func (s *BlockService) GetBlock(ctx context.Context, k key.Key) (*blocks.Block,
block, err := s.Blockstore.Get(k)
if err == nil {
return block, nil
}
if err == blockstore.ErrNotFound && s.Exchange != nil {
// TODO be careful checking ErrNotFound. If the underlying
// implementation changes, this will break.
} else if err == blockstore.ErrNotFound && s.Exchange != nil {
log.Debug("Blockservice: Searching bitswap.")
blk, err := s.Exchange.GetBlock(ctx, k)
if err != nil {
return nil, err
}
return blk, nil
} else {
log.Debug("Blockservice GetBlock: Not found.")
}
log.Debug("Blockservice GetBlock: Not found.")
if err == blockstore.ErrNotFound {
return nil, ErrNotFound
}
return nil, err
}
// GetBlocks gets a list of blocks asynchronously and returns through
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment