erigon-pulse/cmd/state/commands/gas_limits.go
Alex Sharov 9324d83cb2
ethdb.KV interface - pase 2 (#420)
* - handle cursor.Prefix on server
- move state reports to KV interface

* add CmdCursorSeekKey

* tests for abstract_kv

* avoid reading configs of databases

* avoid reading configs of databases

* make linter happy

* make linter happy

* cleanup

* port badger features from original implementation

* try to fix test

* try to fix test

* .Close() don't return error anymore - defer friendly

* try to enable badger now

* try to enable badger now

* badger can't run on CI yet

* badger can't run on CI yet

* re-run ci

* skip ctx cancelation for badger
2020-04-04 08:18:10 +01:00

39 lines
796 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() {
withChaindata(gasLimitsCmd)
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(ctx)
if err != nil {
return err
}
fmt.Println("Processing started...")
stateless.NewGasLimitReporter(ctx, remoteDB, localDB).GasLimits(ctx)
return nil
},
}