2019-11-25 13:46:36 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2019-12-06 07:18:26 +00:00
|
|
|
"fmt"
|
|
|
|
|
2020-01-15 12:47:13 +00:00
|
|
|
"github.com/ledgerwatch/bolt"
|
2019-11-25 13:46:36 +00:00
|
|
|
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
|
2020-03-11 11:02:37 +00:00
|
|
|
"github.com/ledgerwatch/turbo-geth/ethdb/remote"
|
2019-11-25 13:46:36 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
withChaindata(gasLimitsCmd)
|
2019-12-06 07:18:26 +00:00
|
|
|
withRemoteDb(gasLimitsCmd)
|
2019-11-25 13:46:36 +00:00
|
|
|
rootCmd.AddCommand(gasLimitsCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
var gasLimitsCmd = &cobra.Command{
|
|
|
|
Use: "gasLimits",
|
|
|
|
Short: "gasLimits",
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
2020-01-15 12:47:13 +00:00
|
|
|
localDb, err := bolt.Open(file()+"_gl", 0600, &bolt.Options{})
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2019-12-16 14:54:30 +00:00
|
|
|
ctx := getContext()
|
2020-03-11 11:02:37 +00:00
|
|
|
|
|
|
|
remoteDb, err := remote.Open(ctx, remote.DefaultOpts.Addr(remoteDbAddress))
|
2019-12-06 07:18:26 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("Processing started...")
|
2020-01-15 12:47:13 +00:00
|
|
|
stateless.NewGasLimitReporter(ctx, remoteDb, localDb).GasLimits(ctx)
|
2019-11-25 13:46:36 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|