diff --git a/indexer/abci.go b/indexer/abci.go index c8b6ef0..9dc48ee 100644 --- a/indexer/abci.go +++ b/indexer/abci.go @@ -138,19 +138,11 @@ func (e *EVMIndexerImpl) ListenFinalizeBlock(ctx context.Context, req abci.Reque Extra: []byte{}, } - // fill parent hash - if blockHeight > 1 { - parentHeader, err := e.BlockHeaderMap.Get(sdkCtx, uint64(blockHeight-1)) - if err == nil { - blockHeader.ParentHash = parentHeader.Hash() - } - } - blockHash := blockHeader.Hash() blockLogs := make([][]*coretypes.Log, 0, len(ethTxs)) - for txIndex, ethTx := range ethTxs { + for idx, ethTx := range ethTxs { txHash := ethTx.Hash() - receipt := receipts[txIndex] + receipt := receipts[idx] // store tx rpcTx := rpctypes.NewRPCTransaction(ethTx, blockHash, uint64(blockHeight), uint64(receipt.TransactionIndex), chainId) @@ -176,7 +168,7 @@ func (e *EVMIndexerImpl) ListenFinalizeBlock(ctx context.Context, req abci.Reque log.BlockHash = blockHash log.BlockNumber = uint64(blockHeight) log.TxHash = txHash - log.TxIndex = uint(txIndex) + log.TxIndex = uint(receipt.TransactionIndex) } blockLogs = append(blockLogs, receipt.Logs) diff --git a/indexer/store.go b/indexer/store.go index dee7636..0e952f4 100644 --- a/indexer/store.go +++ b/indexer/store.go @@ -4,7 +4,6 @@ import ( "context" corestoretypes "cosmossdk.io/core/store" - "cosmossdk.io/errors" cachekv "cosmossdk.io/store/cachekv" storetypes "cosmossdk.io/store/types" @@ -78,10 +77,9 @@ func (c CacheStore) Set(key, value []byte) error { storetypes.AssertValidKey(key) storetypes.AssertValidValue(value) - err := c.cache.Set(string(key), value) - if err != nil { - return errors.Wrap(err, "failed to set cache") - } + // ignore cache error + _ = c.cache.Set(string(key), value) + c.store.Set(key, value) return nil @@ -91,10 +89,9 @@ func (c CacheStore) Set(key, value []byte) error { func (c CacheStore) Delete(key []byte) error { storetypes.AssertValidKey(key) - err := c.cache.Delete(string(key)) - if err != nil && errors.IsOf(err, bigcache.ErrEntryNotFound) { - return errors.Wrap(err, "failed to delete cache") - } + // ignore cache error + _ = c.cache.Delete(string(key)) + c.store.Delete(key) return nil