Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Dec 10, 2024
1 parent 28c13a9 commit d3d193e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions engine/verification/verifier/verifiers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package verifier

import (
"errors"
"fmt"

"github.com/rs/zerolog"
Expand Down Expand Up @@ -76,15 +77,15 @@ func VerifyRange(
from, to uint64,
chainID flow.ChainID,
protocolDataDir string, chunkDataPackDir string,
) error {
) (err error) {
closer, storages, chunkDataPacks, state, verifier, err := initStorages(chainID, protocolDataDir, chunkDataPackDir)
if err != nil {
return fmt.Errorf("could not init storages: %w", err)
}
defer func() {
err := closer()
if err != nil {
log.Error().Err(err).Msg("failed to close storages")
closerErr := closer()
if closerErr != nil {
err = errors.Join(err, closerErr)
}
}()

Expand Down Expand Up @@ -132,12 +133,12 @@ func initStorages(chainID flow.ChainID, dataDir string, chunkDataPackDir string)

verifier := makeVerifier(log.Logger, chainID, storages.Headers)
closer := func() error {
var dbErr, chunkDataPackDBErr error
var dbErr, chunkDataPackDBErr error

if err := db.Close(); err != nil {
dbErr = fmt.Errorf("failed to close protocol db: %w", err)
}

if err := chunkDataPackDB.Close(); err != nil {
chunkDataPackDBErr = fmt.Errorf("failed to close chunk data pack db: %w", err)
}
Expand Down

0 comments on commit d3d193e

Please sign in to comment.