Skip to content

Commit

Permalink
fix: fix some code as comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi committed May 23, 2024
1 parent 7982041 commit 5399ff6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/geth/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/triedb"
Expand Down Expand Up @@ -225,8 +226,6 @@ the expected order for the overlay tree migration.
}
)

const minBlockAmountReserved uint64 = 90000

func accessDb(ctx *cli.Context, stack *node.Node) (ethdb.Database, error) {
//The layer of tries trees that keep in memory.
TriesInMemory := int(ctx.Uint64(utils.TriesInMemoryFlag.Name))
Expand All @@ -253,7 +252,6 @@ func accessDb(ctx *cli.Context, stack *node.Node) (ethdb.Database, error) {
if dbScheme == rawdb.PathScheme {
config = &triedb.Config{
PathDB: utils.PathDBConfigAddJournalFilePath(stack, pathdb.ReadOnly),
Cache: 0,
}
} else if dbScheme == rawdb.HashScheme {
config = triedb.HashDefaults
Expand Down Expand Up @@ -346,10 +344,9 @@ func pruneBlock(ctx *cli.Context) error {
stack, config = makeConfigNode(ctx)
defer stack.Close()
blockAmountReserved = ctx.Uint64(utils.BlockAmountReserved.Name)
if blockAmountReserved < minBlockAmountReserved {
return fmt.Errorf("block-amount-reserved must be greater than or equal to %d", minBlockAmountReserved)
if blockAmountReserved < params.FullImmutabilityThreshold {
return fmt.Errorf("block-amount-reserved must be greater than or equal to %d", params.FullImmutabilityThreshold)
}
log.Info("blockAmountReserved xxx", "blockAmountReserved", blockAmountReserved)
chaindb, err = accessDb(ctx, stack)
if err != nil {
return err
Expand Down

0 comments on commit 5399ff6

Please sign in to comment.