From 1ca8145aa38d196769d82e155c5c4dbb9d566c97 Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Tue, 21 May 2024 14:50:09 +0800 Subject: [PATCH] fix: fix some code as comment --- cmd/geth/snapshot.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/geth/snapshot.go b/cmd/geth/snapshot.go index 2994384de2..040736a0d7 100644 --- a/cmd/geth/snapshot.go +++ b/cmd/geth/snapshot.go @@ -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" @@ -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)) @@ -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 @@ -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