diff --git a/plugin/evm/atomic_tx_repository.go b/plugin/evm/atomic_tx_repository.go index 4d2d67ae14..b9fef1091c 100644 --- a/plugin/evm/atomic_tx_repository.go +++ b/plugin/evm/atomic_tx_repository.go @@ -116,10 +116,6 @@ func (a *atomicTxRepository) initializeHeightIndex(lastAcceptedHeight uint64) er // Keep track of the size of the currently pending writes pendingBytesApproximation := 0 for iter.Next() { - if err := iter.Error(); err != nil { - return fmt.Errorf("atomic tx DB iterator errored while initializing atomic trie: %w", err) - } - // iter.Value() consists of [height packed as uint64] + [tx serialized as packed []byte] iterValue := iter.Value() if len(iterValue) < wrappers.LongLen { @@ -162,6 +158,9 @@ func (a *atomicTxRepository) initializeHeightIndex(lastAcceptedHeight uint64) er log.Info("Atomic repository initialization", "indexedTxs", indexedTxs) } } + if err := iter.Error(); err != nil { + return fmt.Errorf("atomic tx DB iterator errored while initializing atomic trie: %w", err) + } // Updated the value stored [maxIndexedHeightKey] to be the lastAcceptedHeight indexedHeight := make([]byte, wrappers.LongLen)