Browse Source

inspect: remove duplicated construction path (#6966)

pull/6972/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
07d10184a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 32 deletions
  1. +2
    -26
      cmd/tendermint/commands/inspect.go
  2. +0
    -0
      internal/inspect/doc.go
  3. +2
    -3
      internal/inspect/inspect.go
  4. +7
    -3
      internal/inspect/inspect_test.go
  5. +0
    -0
      internal/inspect/rpc/rpc.go

+ 2
- 26
cmd/tendermint/commands/inspect.go View File

@ -8,12 +8,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/inspect"
"github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/state/indexer/sink"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/internal/inspect"
) )
// InspectCmd is the command for starting an inspect server. // InspectCmd is the command for starting an inspect server.
@ -55,29 +50,10 @@ func runInspect(cmd *cobra.Command, args []string) error {
cancel() cancel()
}() }()
blockStoreDB, err := cfg.DefaultDBProvider(&cfg.DBContext{ID: "blockstore", Config: config})
ins, err := inspect.NewFromConfig(logger, config)
if err != nil { if err != nil {
return err return err
} }
blockStore := store.NewBlockStore(blockStoreDB)
stateDB, err := cfg.DefaultDBProvider(&cfg.DBContext{ID: "state", Config: config})
if err != nil {
if err := blockStoreDB.Close(); err != nil {
logger.Error("error closing block store db", "error", err)
}
return err
}
genDoc, err := types.GenesisDocFromFile(config.GenesisFile())
if err != nil {
return err
}
sinks, err := sink.EventSinksFromConfig(config, cfg.DefaultDBProvider, genDoc.ChainID)
if err != nil {
return err
}
stateStore := state.NewStore(stateDB)
ins := inspect.New(config.RPC, blockStore, stateStore, sinks, logger)
logger.Info("starting inspect server") logger.Info("starting inspect server")
if err := ins.Run(ctx); err != nil { if err := ins.Run(ctx); err != nil {


inspect/doc.go → internal/inspect/doc.go View File


inspect/inspect.go → internal/inspect/inspect.go View File


inspect/inspect_test.go → internal/inspect/inspect_test.go View File


inspect/rpc/rpc.go → internal/inspect/rpc/rpc.go View File


Loading…
Cancel
Save