github.com/badrootd/celestia-core@v0.0.0-20240305091328-aa4207a4b25d/state/txindex/null/null.go (about) 1 package null 2 3 import ( 4 "context" 5 "errors" 6 7 abci "github.com/badrootd/celestia-core/abci/types" 8 "github.com/badrootd/celestia-core/libs/pubsub/query" 9 "github.com/badrootd/celestia-core/state/txindex" 10 ) 11 12 var _ txindex.TxIndexer = (*TxIndex)(nil) 13 14 // TxIndex acts as a /dev/null. 15 type TxIndex struct{} 16 17 // Get on a TxIndex is disabled and panics when invoked. 18 func (txi *TxIndex) Get(hash []byte) (*abci.TxResult, error) { 19 return nil, errors.New(`indexing is disabled (set 'tx_index = "kv"' in config)`) 20 } 21 22 // AddBatch is a noop and always returns nil. 23 func (txi *TxIndex) AddBatch(batch *txindex.Batch) error { 24 return nil 25 } 26 27 // Index is a noop and always returns nil. 28 func (txi *TxIndex) Index(result *abci.TxResult) error { 29 return nil 30 } 31 32 func (txi *TxIndex) Search(ctx context.Context, q *query.Query) ([]*abci.TxResult, error) { 33 return []*abci.TxResult{}, nil 34 }