From 8c84443e779451ea47d159c8210a5cc3f1a24a96 Mon Sep 17 00:00:00 2001 From: Hanjiang Yu Date: Sun, 21 Jul 2019 13:26:52 +0800 Subject: [PATCH] consensus: don't use mmap if cache/dataset disk item is not allowed --- consensus/ethash/ethash.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 78892e1da8..a012d0a583 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -223,7 +223,7 @@ func (c *cache) generate(dir string, limit int, test bool) { size = 1024 } // If we don't store anything on disk, generate and return. - if dir == "" { + if dir == "" || limit <= 0 { c.cache = make([]uint32, size/4) generateCache(c.cache, c.epoch, seed) return @@ -305,7 +305,7 @@ func (d *dataset) generate(dir string, limit int, test bool) { dsize = 32 * 1024 } // If we don't store anything on disk, generate and return - if dir == "" { + if dir == "" || limit <= 0 { cache := make([]uint32, csize/4) generateCache(cache, d.epoch, seed)