cmd/utils, core: only full sync for fast nodes (#2280)
This commit is contained in:
parent
fdbe2e3cb0
commit
fd284c74dd
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user