From e6280a19ccd74176c1bd0c9adbc6669575cdfaaa Mon Sep 17 00:00:00 2001 From: weiihann Date: Fri, 23 Feb 2024 14:29:19 +0800 Subject: [PATCH] cmd/utils: disable snap protocol for fast node --- cmd/utils/flags.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index e7dac8e4ce..dd1bf0e519 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1921,6 +1921,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if cfg.TriesVerifyMode.NeedRemoteVerify() { cfg.EnableTrustProtocol = true } + // A node without trie is not able to provide snap data, so it should disable snap protocol. + if cfg.TriesVerifyMode != core.LocalVerify { + log.Info("Automatically disables snap protocol due to verify mode", "mode", cfg.TriesVerifyMode) + cfg.DisableSnapProtocol = true + } } if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) { cfg.SnapshotCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100