-
Notifications
You must be signed in to change notification settings - Fork 147
/
null.go
35 lines (26 loc) · 855 Bytes
/
null.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package null
import (
"context"
"errors"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/pubsub/query"
"github.com/rollkit/rollkit/state/txindex"
)
var _ txindex.TxIndexer = (*TxIndex)(nil)
// TxIndex acts as a /dev/null.
type TxIndex struct{}
// Get on a TxIndex is disabled and panics when invoked.
func (txi *TxIndex) Get(hash []byte) (*abci.TxResult, error) {
return nil, errors.New(`indexing is disabled (set 'tx_index = "kv"' in config)`)
}
// AddBatch is a noop and always returns nil.
func (txi *TxIndex) AddBatch(batch *txindex.Batch) error {
return nil
}
// Index is a noop and always returns nil.
func (txi *TxIndex) Index(result *abci.TxResult) error {
return nil
}
func (txi *TxIndex) Search(ctx context.Context, q *query.Query) ([]*abci.TxResult, error) {
return []*abci.TxResult{}, nil
}