diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index 0cdec03a5b..b7824ddc0d 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -108,11 +108,9 @@ func NewFreezer(datadir string, namespace string, readonly bool, maxTableSize ui // Leveldb uses LOCK as the filelock filename. To prevent the // name collision, we use FLOCK as the lock name. lock := flock.New(flockFile) - tryLock := func() (bool, error) { - if readonly { - return lock.TryRLock() - } - return lock.TryLock() + tryLock := lock.TryLock + if readonly { + tryLock = lock.TryRLock } if locked, err := tryLock(); err != nil { return nil, err