mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
fc7291ec34
* Use local db in analytics (#308) * pool of encoders * incr and decr funcs
36 lines
738 B
Go
36 lines
738 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ledgerwatch/bolt"
|
|
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
|
|
"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 {
|
|
localDb, err := bolt.Open(file()+"_gl", 0600, &bolt.Options{})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
ctx := getContext()
|
|
remoteDb, err := connectRemoteDb(ctx, remoteDbAddress)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("Processing started...")
|
|
stateless.NewGasLimitReporter(ctx, remoteDb, localDb).GasLimits(ctx)
|
|
return nil
|
|
},
|
|
}
|