Documentation ¶
Overview ¶
Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.
Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE
Index ¶
- Constants
- func LoadFirstBlock(db dbm.DB) (int64, error)
- func LoadLastBlock(db dbm.DB) (int64, error)
- func TxHashKey(hash common.Hash) []byte
- func TxIndexKey(blockNumber int64, txIndex int32) []byte
- type KVIndexer
- func (kv *KVIndexer) FirstIndexedBlock() (int64, error)
- func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*evmostypes.TxResult, error)
- func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*evmostypes.TxResult, error)
- func (kv *KVIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.ResponseDeliverTx) error
- func (kv *KVIndexer) LastIndexedBlock() (int64, error)
Constants ¶
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 ¶
LoadFirstBlock loads the first indexed block, returns -1 if db is empty
func LoadLastBlock ¶
LoadLastBlock returns the latest indexed block number, returns -1 if db is empty
func TxIndexKey ¶
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 a eth tx indexer on a KV db.
func NewKVIndexer ¶
NewKVIndexer creates the KVIndexer
func (*KVIndexer) FirstIndexedBlock ¶
FirstIndexedBlock returns the first indexed block number, returns -1 if db is empty
func (*KVIndexer) GetByBlockAndIndex ¶
func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*evmostypes.TxResult, error)
GetByBlockAndIndex finds eth tx by block number and eth tx index
func (*KVIndexer) GetByTxHash ¶
GetByTxHash finds eth tx by eth tx hash
func (*KVIndexer) IndexBlock ¶
IndexBlock index all the eth txs in a block through the following 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) LastIndexedBlock ¶
LastIndexedBlock returns the latest indexed block number, returns -1 if db is empty