mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-28 13:41:21 +00:00
add config option for tx indexing and disable it by default
This commit is contained in:
parent
d62e85757f
commit
b08f29cb71
@ -101,6 +101,8 @@ func GetConfig(rootDir string) cfg.Config {
|
||||
mapConfig.SetDefault("mempool_broadcast", true)
|
||||
mapConfig.SetDefault("mempool_wal_dir", rootDir+"/data/mempool.wal")
|
||||
|
||||
mapConfig.SetDefault("tx_indexer", "none")
|
||||
|
||||
return mapConfig
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,8 @@ func ResetConfig(localPath string) cfg.Config {
|
||||
mapConfig.SetDefault("mempool_broadcast", true)
|
||||
mapConfig.SetDefault("mempool_wal_dir", "")
|
||||
|
||||
mapConfig.SetDefault("tx_indexer", "none")
|
||||
|
||||
logger.SetLogLevel(mapConfig.GetString("log_level"))
|
||||
|
||||
return mapConfig
|
||||
|
@ -44,6 +44,7 @@ type State struct {
|
||||
TxIndexer tx.Indexer `json:"-"` // Transaction indexer.
|
||||
}
|
||||
|
||||
// Used in tests.
|
||||
func LoadState(db dbm.DB) *State {
|
||||
return loadState(db, stateKey)
|
||||
}
|
||||
@ -132,8 +133,13 @@ func GetState(config cfg.Config, stateDB dbm.DB) *State {
|
||||
}
|
||||
|
||||
// Transaction indexing
|
||||
store := dbm.NewDB("tx_indexer", config.GetString("db_backend"), config.GetString("db_dir"))
|
||||
state.TxIndexer = txindexer.NewKV(store)
|
||||
switch config.GetString("tx_indexer") {
|
||||
case "kv":
|
||||
store := dbm.NewDB("tx_indexer", config.GetString("db_backend"), config.GetString("db_dir"))
|
||||
state.TxIndexer = txindexer.NewKV(store)
|
||||
default:
|
||||
state.TxIndexer = &txindexer.Null{}
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user