Skip to content

Commit

Permalink
fix(node): decompose initDB to make CI happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Jun 4, 2021
1 parent 6b35d36 commit f200949
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,6 @@ func initDBs(
dbProvider DBProvider,
dag iface.APIDagService,
) (blockStore *store.BlockStore, stateDB dbm.DB, err error) {
var blockStoreDB dbm.DB
blockStoreDB, err = dbProvider(&DBContext{"blockstore", config})
if err != nil {
return
}
blockStore = store.NewBlockStore(blockStoreDB, dag)

stateDB, err = dbProvider(&DBContext{"state", config})
if err != nil {
return
}

return
}
Expand Down Expand Up @@ -646,12 +635,7 @@ func NewNode(config *cfg.Config,
logger log.Logger,
options ...Option) (*Node, error) {

dag, ipfsNode, err := ipfsProvider()
if err != nil {
return nil, err
}

blockStore, stateDB, err := initDBs(config, dbProvider, dag)
stateDB, err := dbProvider(&DBContext{"state", config})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -706,6 +690,18 @@ func NewNode(config *cfg.Config,
stateSync = false
}

dag, ipfsNode, err := ipfsProvider()
if err != nil {
return nil, err
}

blockStoreDB, err := dbProvider(&DBContext{"blockstore", config})
if err != nil {
return nil, err
}

blockStore := store.NewBlockStore(blockStoreDB, dag)

// Create the handshaker, which calls RequestInfo, sets the AppVersion on the state,
// and replays any blocks as necessary to sync tendermint with the app.
consensusLogger := logger.With("module", "consensus")
Expand Down

0 comments on commit f200949

Please sign in to comment.