mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 12:37:16 +00:00
Add --noverify
flag to /cmd/state to skip roots check. (#205)
This commit is contained in:
parent
84285a5ab1
commit
ebae2fe281
@ -13,6 +13,7 @@ var (
|
||||
snapshotInterval uint64
|
||||
snapshotFrom uint64
|
||||
witnessInterval uint64
|
||||
noverify bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -26,6 +27,7 @@ func init() {
|
||||
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)
|
||||
|
||||
@ -40,7 +42,19 @@ var statelessCmd = &cobra.Command{
|
||||
return ethdb.NewBoltDatabase(path)
|
||||
}
|
||||
|
||||
stateless.Stateless(block, chaindata, statefile, triesize, preroot, snapshotInterval, snapshotFrom, witnessInterval, statsfile, createDb)
|
||||
stateless.Stateless(
|
||||
block,
|
||||
chaindata,
|
||||
statefile,
|
||||
triesize,
|
||||
preroot,
|
||||
snapshotInterval,
|
||||
snapshotFrom,
|
||||
witnessInterval,
|
||||
statsfile,
|
||||
!noverify,
|
||||
createDb,
|
||||
)
|
||||
|
||||
return nil
|
||||
},
|
||||
|
@ -79,6 +79,7 @@ func Stateless(
|
||||
ignoreOlderThan uint64,
|
||||
witnessThreshold uint64,
|
||||
statsfile string,
|
||||
verifySnapshot bool,
|
||||
createDb CreateDbFunc) {
|
||||
|
||||
state.MaxTrieCacheGen = triesize
|
||||
@ -116,13 +117,16 @@ func Stateless(
|
||||
check(err)
|
||||
preRoot = genesisBlock.Header().Root
|
||||
} else {
|
||||
//load_snapshot(db, fmt.Sprintf("/Volumes/tb4/turbo-geth-copy/state_%d", blockNum-1))
|
||||
//loadCodes(db, ethDb)
|
||||
block := bcb.GetBlockByNumber(blockNum - 1)
|
||||
fmt.Printf("Block number: %d\n", blockNum-1)
|
||||
fmt.Printf("Block root hash: %x\n", block.Root())
|
||||
preRoot = block.Root()
|
||||
|
||||
if verifySnapshot {
|
||||
fmt.Println("Verifying snapshot..")
|
||||
checkRoots(stateDb, preRoot, blockNum-1)
|
||||
fmt.Println("Verifying snapshot... OK")
|
||||
}
|
||||
}
|
||||
batch := stateDb.NewBatch()
|
||||
defer func() {
|
||||
|
Loading…
Reference in New Issue
Block a user