Merge pull request #688 from filecoin-project/fix/bsync-err

print better error if no blocksync peers
This commit is contained in:
Łukasz Magiera 2019-12-01 15:57:46 +01:00 committed by GitHub
commit 6de782063d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,8 +156,9 @@ func (bs *BlockSync) GetChainMessages(ctx context.Context, h *types.TipSet, coun
var err error
for _, p := range perm {
res, err := bs.sendRequestToPeer(ctx, peers[p], req)
if err != nil {
res, rerr := bs.sendRequestToPeer(ctx, peers[p], req)
if rerr != nil {
err = rerr
log.Warnf("BlockSync request failed for peer %s: %s", peers[p].String(), err)
continue
}
@ -172,6 +173,10 @@ func (bs *BlockSync) GetChainMessages(ctx context.Context, h *types.TipSet, coun
}
}
if err == nil {
return nil, xerrors.Errorf("GetChainMessages failed, no peers connected")
}
// TODO: What if we have no peers (and err is nil)?
return nil, xerrors.Errorf("GetChainMessages failed with all peers(%d): %w", len(peers), err)
}