From ccc028daf6d20f2d42cc99469ec15821e5229822 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 7 Jun 2021 18:00:38 +0700 Subject: [PATCH] Fix clique snapshot err check (#2115) * save * save * save * save --- consensus/clique/snapshot.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/consensus/clique/snapshot.go b/consensus/clique/snapshot.go index c9dbdc4bb..578cf3a20 100644 --- a/consensus/clique/snapshot.go +++ b/consensus/clique/snapshot.go @@ -20,6 +20,7 @@ import ( "bytes" "context" "errors" + "fmt" "sort" "time" @@ -121,9 +122,9 @@ func lastSnapshot(db ethdb.RwKV) (uint64, error) { lastEnc, err := tx.GetOne(dbutils.CliqueLastSnapshotBucket, LastSnapshotKey()) if err != nil { - if !errors.Is(err, ethdb.ErrKeyNotFound) { - log.Error("can't check last snapshot", "err", err) - } + return 0, fmt.Errorf("failed check last clique snapshot: %d", err) + } + if len(lastEnc) == 0 { return 0, ErrNotFound }