sealing: Fix pledgeReader

This commit is contained in:
Łukasz Magiera 2020-01-30 07:41:30 +01:00
parent 8c2bdf984c
commit c63fc61a52

View File

@ -5,6 +5,7 @@ import (
"context" "context"
"io" "io"
"math" "math"
"math/bits"
"math/rand" "math/rand"
"runtime" "runtime"
@ -16,6 +17,8 @@ import (
) )
func (m *Sealing) pledgeReader(size uint64, parts uint64) io.Reader { 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) piece := sectorbuilder.UserBytesForSectorSize((size/127 + size) / parts)
readers := make([]io.Reader, parts) readers := make([]io.Reader, parts)