From 9d2de2b7566c70e741f584cda5c6f66853639f13 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 18 Apr 2017 20:55:40 -0400 Subject: [PATCH] tx_indexer -> tx_index --- config/tendermint/config.go | 2 +- config/tendermint_test/config.go | 2 +- node/node.go | 6 +++--- rpc/core/types/responses.go | 2 +- rpc/core/types/responses_test.go | 6 +++--- state/txindex/kv/kv_test.go | 4 ++-- state/txindex/null/null.go | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/tendermint/config.go b/config/tendermint/config.go index 19f7386b7..5ddde460d 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -101,7 +101,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("mempool_broadcast", true) mapConfig.SetDefault("mempool_wal_dir", rootDir+"/data/mempool.wal") - mapConfig.SetDefault("tx_indexer", "kv") + mapConfig.SetDefault("tx_index", "kv") return mapConfig } diff --git a/config/tendermint_test/config.go b/config/tendermint_test/config.go index 9cb8ee327..9d405dc95 100644 --- a/config/tendermint_test/config.go +++ b/config/tendermint_test/config.go @@ -107,7 +107,7 @@ func ResetConfig(localPath string) cfg.Config { mapConfig.SetDefault("mempool_broadcast", true) mapConfig.SetDefault("mempool_wal_dir", "") - mapConfig.SetDefault("tx_indexer", "kv") + mapConfig.SetDefault("tx_index", "kv") logger.SetLogLevel(mapConfig.GetString("log_level")) diff --git a/node/node.go b/node/node.go index b75898eb3..990779486 100644 --- a/node/node.go +++ b/node/node.go @@ -90,9 +90,9 @@ func NewNode(config cfg.Config, privValidator *types.PrivValidator, clientCreato // Transaction indexing var txIndexer txindex.TxIndexer - switch config.GetString("tx_indexer") { + switch config.GetString("tx_index") { case "kv": - store := dbm.NewDB("tx_indexer", config.GetString("db_backend"), config.GetString("db_dir")) + store := dbm.NewDB("tx_index", config.GetString("db_backend"), config.GetString("db_dir")) txIndexer = kv.NewTxIndex(store) default: txIndexer = &null.TxIndex{} @@ -381,7 +381,7 @@ func (n *Node) makeNodeInfo() *p2p.NodeInfo { cmn.Fmt("p2p_version=%v", p2p.Version), cmn.Fmt("consensus_version=%v", consensus.Version), cmn.Fmt("rpc_version=%v/%v", rpc.Version, rpccore.Version), - cmn.Fmt("tx_indexer=%v", txIndexerStatus), + cmn.Fmt("tx_index=%v", txIndexerStatus), }, } diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index f73d0e010..a95f259bf 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -46,7 +46,7 @@ func (s *ResultStatus) TxIndexEnabled() bool { } for _, s := range s.NodeInfo.Other { info := strings.Split(s, "=") - if len(info) == 2 && info[0] == "tx_indexer" { + if len(info) == 2 && info[0] == "tx_index" { return info[1] == "on" } } diff --git a/rpc/core/types/responses_test.go b/rpc/core/types/responses_test.go index d1e8aa1b7..69ee4faec 100644 --- a/rpc/core/types/responses_test.go +++ b/rpc/core/types/responses_test.go @@ -26,9 +26,9 @@ func TestStatusIndexer(t *testing.T) { {false, nil}, {false, []string{}}, {false, []string{"a=b"}}, - {false, []string{"tx_indexeriskv", "some=dood"}}, - {true, []string{"tx_indexer=on", "tx_indexer=other"}}, - {true, []string{"^(*^(", "tx_indexer=on", "a=n=b=d="}}, + {false, []string{"tx_indexiskv", "some=dood"}}, + {true, []string{"tx_index=on", "tx_index=other"}}, + {true, []string{"^(*^(", "tx_index=on", "a=n=b=d="}}, } for _, tc := range cases { diff --git a/state/txindex/kv/kv_test.go b/state/txindex/kv/kv_test.go index cd881dfc1..9a1898d7e 100644 --- a/state/txindex/kv/kv_test.go +++ b/state/txindex/kv/kv_test.go @@ -34,13 +34,13 @@ func benchmarkTxIndex(txsCount int, b *testing.B) { tx := types.Tx("HELLO WORLD") txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeType_OK, Log: ""}} - dir, err := ioutil.TempDir("", "tx_indexer_db") + dir, err := ioutil.TempDir("", "tx_index_db") if err != nil { b.Fatal(err) } defer os.RemoveAll(dir) - store := db.NewDB("tx_indexer", "leveldb", dir) + store := db.NewDB("tx_index", "leveldb", dir) indexer := &TxIndex{store: store} batch := txindex.NewBatch(txsCount) diff --git a/state/txindex/null/null.go b/state/txindex/null/null.go index e48e34cf5..4999bbdeb 100644 --- a/state/txindex/null/null.go +++ b/state/txindex/null/null.go @@ -12,7 +12,7 @@ type TxIndex struct{} // Tx panics. func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) { - return nil, errors.New(`Indexing is disabled (set 'tx_indexer = "kv"' in config)`) + return nil, errors.New(`Indexing is disabled (set 'tx_index = "kv"' in config)`) } // Batch returns nil.