consensus: don't use mmap if cache/dataset disk item is not allowed

This commit is contained in:
Hanjiang Yu 2019-07-21 13:26:52 +08:00
parent f34a3a6805
commit 8c84443e77

View file

@ -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)