Skip to content

Commit

Permalink
removing calling stats during init
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkolasg authored and hsanjuan committed Nov 11, 2020
1 parent ead2bc9 commit 32b601e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions chain/boltdb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import (
// db file.
type boltStore struct {
sync.Mutex
db *bolt.DB
len int
db *bolt.DB
}

var beaconBucket = []byte("beacons")
Expand All @@ -31,20 +30,17 @@ func NewBoltStore(folder string, opts *bolt.Options) (chain.Store, error) {
if err != nil {
return nil, err
}
var baseLen = 0
// create the bucket already
err = db.Update(func(tx *bolt.Tx) error {
bucket, err := tx.CreateBucketIfNotExists(beaconBucket)
_, err := tx.CreateBucketIfNotExists(beaconBucket)
if err != nil {
return err
}
baseLen += bucket.Stats().KeyN
return nil
})

return &boltStore{
db: db,
len: baseLen,
db: db,
}, err
}

Expand Down

0 comments on commit 32b601e

Please sign in to comment.