diff --git a/config.go b/config.go index 98df982bd304..48cc053f2533 100644 --- a/config.go +++ b/config.go @@ -22,6 +22,7 @@ var ( FlagCommitValue bool FlagOnOperationValue bool // TODO: Remove in favor of binary search for invariant violation FlagAllInvariantsValue bool + FlagDBBackendValue string FlagEnabledValue bool FlagVerboseValue bool @@ -46,6 +47,7 @@ func GetSimulatorFlags() { flag.BoolVar(&FlagCommitValue, "Commit", false, "have the simulation commit") flag.BoolVar(&FlagOnOperationValue, "SimulateEveryOperation", false, "run slow invariants every operation") flag.BoolVar(&FlagAllInvariantsValue, "PrintAllInvariants", false, "print all invariants if a broken invariant is found") + flag.StringVar(&FlagDBBackendValue, "DBBackend", "goleveldb", "custom db backend type") // simulation flags flag.BoolVar(&FlagEnabledValue, "Enabled", false, "enable the simulation") @@ -71,5 +73,6 @@ func NewConfigFromFlags() simulation.Config { Commit: FlagCommitValue, OnOperation: FlagOnOperationValue, AllInvariants: FlagAllInvariantsValue, + DBBackend: FlagDBBackendValue, } } diff --git a/simd/cmd/root.go b/simd/cmd/root.go index d1425eb8924c..9ae7f10a7b48 100644 --- a/simd/cmd/root.go +++ b/simd/cmd/root.go @@ -261,7 +261,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a } snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) + snapshotDB, err := dbm.NewDB("metadata", server.GetAppDBBackend(appOpts), snapshotDir) if err != nil { panic(err) } diff --git a/utils.go b/utils.go index 51d8ef54020f..1478104a5d8c 100644 --- a/utils.go +++ b/utils.go @@ -39,7 +39,7 @@ func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, return simtypes.Config{}, nil, "", nil, false, err } - db, err := sdk.NewLevelDB(dbName, dir) + db, err := dbm.NewDB(dbName, dbm.BackendType(config.DBBackend), dir) if err != nil { return simtypes.Config{}, nil, "", nil, false, err }