Skip to content

Commit

Permalink
Fix db options
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-lashin committed Mar 1, 2020
1 parent 1bc45e1 commit f21b6ca
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions core/minter/minter.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ const (

var (
blockchain *Blockchain

dbOpts = &opt.Options{
OpenFilesCacheCapacity: 1024,
BlockCacheCapacity: 1024 / 2 * opt.MiB,
WriteBuffer: 1024 / 4 * opt.MiB, // Two of these are used internally
Filter: filter.NewBloomFilter(10),
}
)

// Main structure of Minter Blockchain
Expand Down Expand Up @@ -81,15 +74,15 @@ type Blockchain struct {
func NewMinterBlockchain(cfg *config.Config) *Blockchain {
var err error

ldb, err := db.NewGoLevelDBWithOpts("state", utils.GetMinterHome()+"/data", dbOpts)
ldb, err := db.NewGoLevelDBWithOpts("state", utils.GetMinterHome()+"/data", getDbOpts())
if err != nil {
panic(err)
}

// Initiate Application DB. Used for persisting data like current block, validators, etc.
applicationDB := appdb.NewAppDB(cfg)

edb, err := db.NewGoLevelDBWithOpts("events", utils.GetMinterHome()+"/data", dbOpts)
edb, err := db.NewGoLevelDBWithOpts("events", utils.GetMinterHome()+"/data", getDbOpts())
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -600,3 +593,12 @@ func (app *Blockchain) calcMaxGas(height uint64) uint64 {
func (app *Blockchain) GetEventsDB() eventsdb.IEventsDB {
return app.eventsDB
}

func getDbOpts() *opt.Options {
return &opt.Options{
OpenFilesCacheCapacity: 1024,
BlockCacheCapacity: 1024 / 2 * opt.MiB,
WriteBuffer: 1024 / 4 * opt.MiB, // Two of these are used internally
Filter: filter.NewBloomFilter(10),
}
}

0 comments on commit f21b6ca

Please sign in to comment.