From 6af520174703d799d355c764a4d2a2ead1cb2158 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Fri, 27 Jun 2025 02:00:31 +0000 Subject: [PATCH] cmd: no need to indexing the whole blocks in pbss archive Signed-off-by: jsvisa --- cmd/utils/flags.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3747e2c70b..71941cdf9d 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1656,11 +1656,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { log.Warn("The flag --txlookuplimit is deprecated and will be removed, please use --history.transactions") cfg.TransactionHistory = ctx.Uint64(TxLookupLimitFlag.Name) } - if ctx.String(GCModeFlag.Name) == "archive" { - if cfg.TransactionHistory != 0 { - cfg.TransactionHistory = 0 - log.Warn("Disabled transaction unindexing for archive node") + + if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 && ctx.IsSet(DataDirFlag.Name) { + chaindb := tryMakeReadOnlyDatabase(ctx, stack) + scheme, err := rawdb.ParseStateScheme(cfg.StateScheme, chaindb) + if err != nil { + Fatalf("%v", err) } + if scheme == rawdb.HashScheme { + cfg.TransactionHistory = 0 + log.Warn("Disabled transaction unindexing for archive node with hash state scheme") + } + chaindb.Close() } if ctx.IsSet(LogHistoryFlag.Name) { cfg.LogHistory = ctx.Uint64(LogHistoryFlag.Name)