mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-26 07:12:16 +00:00
add tx_index config
This commit is contained in:
parent
acae38ab9e
commit
cd4be1f308
@ -16,6 +16,7 @@ type Config struct {
|
|||||||
P2P *P2PConfig `mapstructure:"p2p"`
|
P2P *P2PConfig `mapstructure:"p2p"`
|
||||||
Mempool *MempoolConfig `mapstructure:"mempool"`
|
Mempool *MempoolConfig `mapstructure:"mempool"`
|
||||||
Consensus *ConsensusConfig `mapstructure:"consensus"`
|
Consensus *ConsensusConfig `mapstructure:"consensus"`
|
||||||
|
TxIndex *TxIndexConfig `mapstructure:"tx_index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConfig returns a default configuration for a Tendermint node
|
// DefaultConfig returns a default configuration for a Tendermint node
|
||||||
@ -26,6 +27,7 @@ func DefaultConfig() *Config {
|
|||||||
P2P: DefaultP2PConfig(),
|
P2P: DefaultP2PConfig(),
|
||||||
Mempool: DefaultMempoolConfig(),
|
Mempool: DefaultMempoolConfig(),
|
||||||
Consensus: DefaultConsensusConfig(),
|
Consensus: DefaultConsensusConfig(),
|
||||||
|
TxIndex: DefaultTxIndexConfig(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ func TestConfig() *Config {
|
|||||||
P2P: TestP2PConfig(),
|
P2P: TestP2PConfig(),
|
||||||
Mempool: DefaultMempoolConfig(),
|
Mempool: DefaultMempoolConfig(),
|
||||||
Consensus: TestConsensusConfig(),
|
Consensus: TestConsensusConfig(),
|
||||||
|
TxIndex: DefaultTxIndexConfig(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,9 +96,6 @@ type BaseConfig struct {
|
|||||||
// so the app can decide if we should keep the connection or not
|
// so the app can decide if we should keep the connection or not
|
||||||
FilterPeers bool `mapstructure:"filter_peers"` // false
|
FilterPeers bool `mapstructure:"filter_peers"` // false
|
||||||
|
|
||||||
// What indexer to use for transactions
|
|
||||||
TxIndex string `mapstructure:"tx_index"`
|
|
||||||
|
|
||||||
// Database backend: leveldb | memdb
|
// Database backend: leveldb | memdb
|
||||||
DBBackend string `mapstructure:"db_backend"`
|
DBBackend string `mapstructure:"db_backend"`
|
||||||
|
|
||||||
@ -115,7 +115,6 @@ func DefaultBaseConfig() BaseConfig {
|
|||||||
ProfListenAddress: "",
|
ProfListenAddress: "",
|
||||||
FastSync: true,
|
FastSync: true,
|
||||||
FilterPeers: false,
|
FilterPeers: false,
|
||||||
TxIndex: "kv",
|
|
||||||
DBBackend: "leveldb",
|
DBBackend: "leveldb",
|
||||||
DBPath: "data",
|
DBPath: "data",
|
||||||
}
|
}
|
||||||
@ -412,6 +411,27 @@ func (c *ConsensusConfig) SetWalFile(walFile string) {
|
|||||||
c.walFile = walFile
|
c.walFile = walFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// TxIndexConfig
|
||||||
|
|
||||||
|
// TxIndexConfig defines the confuguration for the transaction
|
||||||
|
// indexer, including tags to index.
|
||||||
|
type TxIndexConfig struct {
|
||||||
|
// What indexer to use for transactions
|
||||||
|
Indexer string `mapstructure:"indexer"`
|
||||||
|
|
||||||
|
// Comma-separated list of tags to index (by default only by tx hash)
|
||||||
|
IndexTags string `mapstructure:"index_tags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultTxIndexConfig returns a default configuration for the transaction indexer.
|
||||||
|
func DefaultTxIndexConfig() *TxIndexConfig {
|
||||||
|
return &TxIndexConfig{
|
||||||
|
Indexer: "kv",
|
||||||
|
IndexTags: "tx.hash", // types.TxHashKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Utils
|
// Utils
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ func NewNode(config *cfg.Config,
|
|||||||
|
|
||||||
// Transaction indexing
|
// Transaction indexing
|
||||||
var txIndexer txindex.TxIndexer
|
var txIndexer txindex.TxIndexer
|
||||||
switch config.TxIndex {
|
switch config.TxIndex.Indexer {
|
||||||
case "kv":
|
case "kv":
|
||||||
store, err := dbProvider(&DBContext{"tx_index", config})
|
store, err := dbProvider(&DBContext{"tx_index", config})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user