Skip to content

Commit 98aec1c

Browse files
committed
add iavlx-options to server
1 parent eb32c2d commit 98aec1c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

server/start.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const (
7676
FlagIAVLCacheSize = "iavl-cache-size"
7777
FlagDisableIAVLFastNode = "iavl-disable-fastnode"
7878
FlagIAVLSyncPruning = "iavl-sync-pruning"
79+
FlagIAVLXOptions = "iavlx-options"
7980
FlagShutdownGrace = "shutdown-grace"
8081

8182
// state sync-related flags

server/util.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package server
22

33
import (
44
"context"
5+
"encoding/json"
56
"errors"
67
"fmt"
78
"io"
@@ -584,9 +585,18 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) {
584585
baseapp.SetChainID(chainID),
585586
baseapp.SetQueryGasLimit(cast.ToUint64(appOpts.Get(FlagQueryGasLimit))),
586587
func(bapp *baseapp.BaseApp) {
588+
opts := &iavlx.Options{}
589+
optsJson, ok := appOpts.Get(FlagIAVLXOptions).(string)
590+
if ok && optsJson != "" {
591+
err := json.Unmarshal([]byte(optsJson), opts)
592+
if err != nil {
593+
panic(fmt.Errorf("failed to unmarshal iavlx options: %w", err))
594+
}
595+
}
596+
587597
db, err := iavlx.LoadDB(
588598
filepath.Join(homeDir, "data", "iavlx"),
589-
&iavlx.Options{},
599+
opts,
590600
bapp.Logger(),
591601
)
592602
if err != nil {

0 commit comments

Comments
 (0)