fix: index-eth-tx
cmd fail on empty indexer db (#1362)
* fix: `index-eth-tx` cmd fail on empty indexer db Solution: - start from latest height is db is empty * update gomod2nix * Update CHANGELOG.md Co-authored-by: Freddy Caceres <facs95@gmail.com>
This commit is contained in:
parent
5759e72ccb
commit
491c3da7eb
@ -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
|
||||
|
||||
|
@ -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="
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user