Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Mar 11, 2024
1 parent 765f22f commit dc92308
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
34 changes: 17 additions & 17 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,6 @@ func New(

keys, memKeys, tkeys := StoreKeys(experimental)

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, keys); err != nil {
fmt.Printf("failed to load state streaming: %s", err)
os.Exit(1)
}

// wire up the versiondb's `StreamingService` and `MultiStore`.
streamers := cast.ToStringSlice(appOpts.Get("store.streamers"))
var qms sdk.MultiStore
if slices.Contains(streamers, "versiondb") {
var err error
qms, err = setupVersionDB(homePath, bApp, keys, tkeys, memKeys)
if err != nil {
panic(err)
}
}

app := &App{
BaseApp: bApp,
cdc: cdc,
Expand Down Expand Up @@ -754,6 +737,23 @@ func New(
app.MountTransientStores(tkeys)
app.MountMemoryStores(memKeys)

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(app.BaseApp, appOpts, appCodec, keys); err != nil {
fmt.Printf("failed to load state streaming: %s", err)
os.Exit(1)
}

// wire up the versiondb's `StreamingService` and `MultiStore`.
streamers := cast.ToStringSlice(appOpts.Get("store.streamers"))
var qms sdk.MultiStore
if slices.Contains(streamers, "versiondb") {
var err error
qms, err = app.setupVersionDB(homePath, keys, tkeys, memKeys)
if err != nil {
panic(err)
}
}

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
app.SetBeginBlocker(app.BeginBlocker)
Expand Down
6 changes: 2 additions & 4 deletions app/versiondb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ import (
"os"
"path/filepath"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/crypto-org-chain/cronos/versiondb"
"github.com/crypto-org-chain/cronos/versiondb/tsrocksdb"
)

func setupVersionDB(
func (app *App) setupVersionDB(
homePath string,
app *baseapp.BaseApp,
keys map[string]*storetypes.KVStoreKey,
tkeys map[string]*storetypes.TransientStoreKey,
memKeys map[string]*storetypes.MemoryStoreKey,
Expand All @@ -39,7 +37,7 @@ func setupVersionDB(
service := versiondb.NewStreamingService(versionDB, exposeStoreKeys)
app.SetStreamingService(service)

verDB := versiondb.NewMultiStore(versionDB, exposeStoreKeys)
verDB := versiondb.NewMultiStore(app.CommitMultiStore(), versionDB, exposeStoreKeys)
verDB.MountTransientStores(tkeys)
verDB.MountMemoryStores(memKeys)

Expand Down
4 changes: 1 addition & 3 deletions app/versiondb_placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ package app
import (
"errors"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

func setupVersionDB(
func (app *App) setupVersionDB(
homePath string,
app *baseapp.BaseApp,
keys map[string]*storetypes.KVStoreKey,
tkeys map[string]*storetypes.TransientStoreKey,
memKeys map[string]*storetypes.MemoryStoreKey,
Expand Down

0 comments on commit dc92308

Please sign in to comment.