cmd/utils: skip memory-limit sanitize when total memory is unknown (#35407)

This commit is contained in:
cui 2026-07-24 15:48:40 +08:00 committed by GitHub
parent ff44a796a1
commit af03a271df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1793,7 +1793,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.IsSet(MemoryLimitFlag.Name) { if ctx.IsSet(MemoryLimitFlag.Name) {
memLimit := int64(ctx.Int(MemoryLimitFlag.Name)) * 1024 * 1024 memLimit := int64(ctx.Int(MemoryLimitFlag.Name)) * 1024 * 1024
if memLimit > int64(total) { if total > 0 && memLimit > int64(total) {
log.Info("Sanitizing memory limit", "provided(MB)", memLimit/1024/1024, "updated(MB)", total/1024/1024) log.Info("Sanitizing memory limit", "provided(MB)", memLimit/1024/1024, "updated(MB)", total/1024/1024)
memLimit = int64(total) memLimit = int64(total)
} }