indexer

package
v12.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPrefixTxHash  = 1
	KeyPrefixTxIndex = 2

	// TxIndexKeyLength is the length of tx-index key
	TxIndexKeyLength = 1 + 8 + 8
)

Variables

This section is empty.

Functions

func LoadFirstBlock

func LoadFirstBlock(db dbm.DB) (int64, error)

LoadFirstBlock loads the first indexed block, returns -1 if db is empty

func LoadLastBlock

func LoadLastBlock(db dbm.DB) (int64, error)

LoadLastBlock returns the latest indexed block number, returns -1 if db is empty

func TxHashKey

func TxHashKey(hash common.Hash) []byte

TxHashKey returns the key for db entry: `tx hash -> tx result struct`

func TxIndexKey

func TxIndexKey(blockNumber int64, txIndex int32) []byte

TxIndexKey returns the key for db entry: `(block number, tx index) -> tx hash`

Types

type KVIndexer

type KVIndexer struct {
	// contains filtered or unexported fields
}

KVIndexer implements an ETH-Tx indexer on a KV db.

func NewKVIndexer

func NewKVIndexer(db dbm.DB, logger log.Logger, clientCtx client.Context) *KVIndexer

NewKVIndexer creates the KVIndexer

func (*KVIndexer) FirstIndexedBlock

func (kv *KVIndexer) FirstIndexedBlock() (int64, error)

FirstIndexedBlock returns the first indexed block number, returns -1 if db is empty

func (*KVIndexer) GetByBlockAndIndex

func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*evertypes.TxResult, error)

GetByBlockAndIndex finds eth tx by block number and eth tx index

func (*KVIndexer) GetByTxHash

func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*evertypes.TxResult, error)

GetByTxHash finds eth tx by eth tx hash

func (*KVIndexer) GetLastRequestIndexedBlock added in v12.2.4

func (kv *KVIndexer) GetLastRequestIndexedBlock() (int64, error)

GetLastRequestIndexedBlock returns the block height of the latest success called to IndexBlock()

func (*KVIndexer) IndexBlock

func (kv *KVIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.ResponseDeliverTx) error

IndexBlock indexes all ETH Txs of the block. Notes: no guarantee data is flushed into database after this function returns, it might be flushed at later point.

Steps: - Iterates over all-of-the Txs in Block - Parses eth Tx infos from cosmos-sdk events for every TxResult - Iterates over all the messages of the Tx - Builds and stores a `indexer.TxResult` based on parsed events for every message

func (*KVIndexer) IsReady added in v12.2.4

func (kv *KVIndexer) IsReady() bool

func (*KVIndexer) LastIndexedBlock

func (kv *KVIndexer) LastIndexedBlock() (int64, error)

LastIndexedBlock returns the last block number which was indexed and flushed into database. Returns -1 if db is empty.

func (*KVIndexer) Ready added in v12.2.4

func (kv *KVIndexer) Ready()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL