erigon-pulse/cmd/state/commands/gas_limits.go

38 lines
765 B
Go
Raw Normal View History

package commands
import (
2019-12-06 07:18:26 +00:00
"fmt"
"github.com/ledgerwatch/bolt"
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
"github.com/ledgerwatch/turbo-geth/ethdb"
"github.com/spf13/cobra"
)
func init() {
2020-07-27 12:15:48 +00:00
withPrivateApi(gasLimitsCmd)
rootCmd.AddCommand(gasLimitsCmd)
}
var gasLimitsCmd = &cobra.Command{
Use: "gasLimits",
Short: "gasLimits",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
localDB, err := bolt.Open(file()+"_gl", 0600, &bolt.Options{})
if err != nil {
panic(err)
}
2020-07-27 12:15:48 +00:00
remoteDB, err := ethdb.NewRemote().Path(privateApiAddr).Open()
2019-12-06 07:18:26 +00:00
if err != nil {
return err
}
fmt.Println("Processing started...")
stateless.NewGasLimitReporter(ctx, remoteDB, localDB).GasLimits(ctx)
return nil
},
}