From c63fc61a52f2b979af2429687acc9b8f9187a55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 30 Jan 2020 07:41:30 +0100 Subject: [PATCH] sealing: Fix pledgeReader --- garbage.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/garbage.go b/garbage.go index 2173759d2..22a282229 100644 --- a/garbage.go +++ b/garbage.go @@ -5,6 +5,7 @@ import ( "context" "io" "math" + "math/bits" "math/rand" "runtime" @@ -16,6 +17,8 @@ import ( ) func (m *Sealing) pledgeReader(size uint64, parts uint64) io.Reader { + parts = 1 << bits.Len64(parts) // round down to nearest power of 2 + piece := sectorbuilder.UserBytesForSectorSize((size/127 + size) / parts) readers := make([]io.Reader, parts)