erigon-pulse/cmd/state/commands/gas_limits.go
Alex Sharov 15096f273d
Remove ctx from Open. Stop goroutines on Close. (#650)
* remove ctx from MustOpen

* remove ctx from Open. Stop goroutines on Close.

* remove ctx from Open. Stop goroutines on Close.

* remove ctx from remote open (we have DialTimeout field to manage connection timeouts)

* enable RawReads and add native implementation of Get/Has methods
2020-06-12 10:31:21 +01:00

38 lines
764 B
Go

package commands
import (
"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() {
withRemoteDb(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)
}
remoteDB, err := ethdb.NewRemote().Path(remoteDbAddress).Open()
if err != nil {
return err
}
fmt.Println("Processing started...")
stateless.NewGasLimitReporter(ctx, remoteDB, localDB).GasLimits(ctx)
return nil
},
}