mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
62 lines
1.8 KiB
Go
62 lines
1.8 KiB
Go
package commands
|
|
|
|
import (
|
|
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
statefile string
|
|
triesize uint32
|
|
preroot bool
|
|
snapshotInterval uint64
|
|
snapshotFrom uint64
|
|
witnessInterval uint64
|
|
noverify bool
|
|
)
|
|
|
|
func init() {
|
|
withChaindata(statelessCmd)
|
|
withStatsfile(statelessCmd)
|
|
withBlock(statelessCmd)
|
|
|
|
statelessCmd.Flags().StringVar(&statefile, "statefile", "state", "path to the file where the state will be periodically written during the analysis")
|
|
statelessCmd.Flags().Uint32Var(&triesize, "triesize", 1024*1024, "maximum number of nodes in the state trie")
|
|
statelessCmd.Flags().BoolVar(&preroot, "preroot", false, "Attempt to compute hash of the trie without modifying it")
|
|
statelessCmd.Flags().Uint64Var(&snapshotInterval, "snapshotInterval", 0, "how often to take snapshots (0 - never, 1 - every block, 1000 - every 1000th block, etc)")
|
|
statelessCmd.Flags().Uint64Var(&snapshotFrom, "snapshotFrom", 0, "from which block to start snapshots")
|
|
statelessCmd.Flags().Uint64Var(&witnessInterval, "witnessInterval", 1, "after which block to extract witness (put a large number like 10000000 to disable)")
|
|
statelessCmd.Flags().BoolVar(&noverify, "noVerify", false, "skip snapshot verification on loading")
|
|
|
|
rootCmd.AddCommand(statelessCmd)
|
|
|
|
}
|
|
|
|
var statelessCmd = &cobra.Command{
|
|
Use: "stateless",
|
|
Short: "Stateless Ethereum prototype",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
createDb := func(path string) (ethdb.Database, error) {
|
|
return ethdb.NewBoltDatabase(path)
|
|
}
|
|
|
|
stateless.Stateless(
|
|
block,
|
|
chaindata,
|
|
statefile,
|
|
triesize,
|
|
preroot,
|
|
snapshotInterval,
|
|
snapshotFrom,
|
|
witnessInterval,
|
|
statsfile,
|
|
!noverify,
|
|
createDb,
|
|
)
|
|
|
|
return nil
|
|
},
|
|
}
|