From b3fe304d823804056ecd0e1a2e5f468df3a940cc Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 6 Nov 2019 20:26:01 +0100 Subject: [PATCH] add is permanent License: MIT Signed-off-by: Jakub Sztandera --- chain/sync.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chain/sync.go b/chain/sync.go index 8c438b0c0..55ac65719 100644 --- a/chain/sync.go +++ b/chain/sync.go @@ -369,6 +369,10 @@ func (syncer *Syncer) Sync(ctx context.Context, maybeHead *types.TipSet) error { return nil } +func isPermanent(err error) bool { + return !errors.Is(err, ErrTemporal) +} + func (syncer *Syncer) ValidateTipSet(ctx context.Context, fts *store.FullTipSet) error { ctx, span := trace.StartSpan(ctx, "validateTipSet") defer span.End() @@ -380,7 +384,7 @@ func (syncer *Syncer) ValidateTipSet(ctx context.Context, fts *store.FullTipSet) for _, b := range fts.Blocks { if err := syncer.ValidateBlock(ctx, b); err != nil { - if !errors.Is(err, ErrTemporal) { + if isPermanent(err) { syncer.bad.Add(b.Cid()) } return xerrors.Errorf("validating block %s: %w", b.Cid(), err)