mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 18:42:19 +00:00
c5ffc971c5
* badger v2 investigation * buf pool - use native New method and avoid double checks * db.Open prototype * db.Tx/Bucket/Cursor prototypes * Chained config * Item concept added * save changes to test on master * make hack resumable * Design document v0 * Cursor concept * less brackets syntax of cursor builder * benchmarks * cleanup fs * test for context cancelations * test for context cancelations * test for cursor.Prefix option * add ForEachKey method * add ForEachKey method * add naming explanation * experiment of non-pointers cursor/bucket * .Bucket() and .Cursor() doesn't returns error * .Bucket() and .Cursor() doesn't returns error * .Bucket() and .Cursor() doesn't returns error * remove CursorOpts concept * more test-cases * simplify open api * Tx, Bucket, Cursor - now are interfaces * Tx, Bucket, Cursor - now are interfaces * switch to interfaces * rebase master Co-authored-by: alex.sharov <alex.sharov@lazada.com>
38 lines
810 B
Go
38 lines
810 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ledgerwatch/bolt"
|
|
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
|
|
"github.com/ledgerwatch/turbo-geth/ethdb/remote"
|
|
"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 := remote.Open(ctx, remote.DefaultOpts.Addr(remoteDbAddress))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("Processing started...")
|
|
stateless.NewGasLimitReporter(ctx, remoteDb, localDb).GasLimits(ctx)
|
|
return nil
|
|
},
|
|
}
|