github.com/vipernet-xyz/tm@v0.34.24/state/txindex/null/null.go (about)

     1  package null
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  
     7  	abci "github.com/vipernet-xyz/tm/abci/types"
     8  	"github.com/vipernet-xyz/tm/libs/pubsub/query"
     9  	"github.com/vipernet-xyz/tm/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  }