diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5238437be..b20c468d0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1953,6 +1953,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if cfg.TriesVerifyMode.NeedRemoteVerify() { cfg.EnableTrustProtocol = true } + + if cfg.SyncMode == downloader.SnapSync && cfg.TriesVerifyMode.NoTries() { + log.Warn("Only local TriesVerifyMode can support snap sync, resetting to full sync", "mode", cfg.TriesVerifyMode) + cfg.SyncMode = downloader.FullSync + } } if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) { cfg.SnapshotCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100 diff --git a/core/remote_state_verifier.go b/core/remote_state_verifier.go index c2c10c2be..7baa5abe4 100644 --- a/core/remote_state_verifier.go +++ b/core/remote_state_verifier.go @@ -444,6 +444,10 @@ func (mode VerifyMode) NeedRemoteVerify() bool { return mode == FullVerify || mode == InsecureVerify } +func (mode VerifyMode) NoTries() bool { + return mode != LocalVerify +} + func newVerifyMsgTypeGauge(msgType uint16, peerId string) metrics.Gauge { m := fmt.Sprintf("verifymanager/message/%d/peer/%s", msgType, peerId) return metrics.GetOrRegisterGauge(m, nil) diff --git a/triedb/pathdb/disklayer.go b/triedb/pathdb/disklayer.go index d25a65e51..f0f8dbe84 100644 --- a/triedb/pathdb/disklayer.go +++ b/triedb/pathdb/disklayer.go @@ -79,10 +79,10 @@ type trienodebuffer interface { func NewTrieNodeBuffer(sync bool, limit int, nodes map[common.Hash]map[string]*trienode.Node, layers uint64) trienodebuffer { if sync { - log.Info("new sync node buffer", "limit", common.StorageSize(limit), "layers", layers) + log.Info("New sync node buffer", "limit", common.StorageSize(limit), "layers", layers) return newNodeBuffer(limit, nodes, layers) } - log.Info("new async node buffer", "limit", common.StorageSize(limit), "layers", layers) + log.Info("New async node buffer", "limit", common.StorageSize(limit), "layers", layers) return newAsyncNodeBuffer(limit, nodes, layers) }