diff --git a/CHANGELOG.md b/CHANGELOG.md index aa100007..0b0bc897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (rpc) [#1284](https://github.com/evmos/ethermint/pull/1284) Fix internal trace response upon incomplete `eth_sendTransaction` call. * (rpc) [#1340](https://github.com/evmos/ethermint/pull/1340) Fix error response when `eth_estimateGas` height provided is not found. * (rpc) [#1354](https://github.com/evmos/ethermint/pull/1354) Fix grpc query failure(`BaseFee` and `EthCall`) on legacy block states. +* (cli) [#1362](https://github.com/evmos/ethermint/pull/1362) Fix `index-eth-tx` error when the indexer db is empty. ## [v0.19.2] - 2022-08-29 diff --git a/gomod2nix.toml b/gomod2nix.toml index bc4dba2b..624dd8be 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -105,8 +105,8 @@ schema = 3 version = "v0.19.2-0.20220916140702-9b6be3095313" hash = "sha256-49xr/7/4L1wZ45eW5lE7C4SlcbGf4gBY+662SfJiWPQ=" [mod."github.com/cosmos/ibc-go/v5"] - version = "v5.0.0-rc2" - hash = "sha256-p4tpb6I6bdXix1sTYivJEygUtM4q+nTIKdSlf6c/LCw=" + version = "v5.0.0" + hash = "sha256-sDZdmuGohaaBF7bxrjo9PWJnmoF+VOkjySYhsFixPz4=" [mod."github.com/cosmos/ledger-cosmos-go"] version = "v0.11.1" hash = "sha256-yli+VvVtZmHo2LPvCY6lYVUfcCDn3sBLDL+a8KIlqDA=" diff --git a/server/indexer_cmd.go b/server/indexer_cmd.go index fe614756..bb2a1969 100644 --- a/server/indexer_cmd.go +++ b/server/indexer_cmd.go @@ -15,11 +15,14 @@ import ( func NewIndexTxCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "index-eth-tx [forward|backward]", + Use: "index-eth-tx [backward|forward]", Short: "Index historical eth txs", Long: `Index historical eth txs, it only support two traverse direction to avoid creating gaps in the indexer db if using arbitrary block ranges: - - backward: index the blocks from the first indexed block to the earliest block in the chain. + - backward: index the blocks from the first indexed block to the earliest block in the chain, if indexer db is empty, start from the latest block. - forward: index the blocks from the latest indexed block to latest block in the chain. + + When start the node, the indexer start from the latest indexed block to avoid creating gap. + Backward mode should be used most of the time, so the latest indexed block is always up-to-date. `, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -82,7 +85,8 @@ func NewIndexTxCmd() *cobra.Command { return err } if first == -1 { - return fmt.Errorf("indexer db is empty") + // start from the latest block if indexer db is empty + first = blockStore.Height() } for i := first - 1; i > 0; i-- { if err := indexBlock(i); err != nil {