sealing: round parts in fastPledgeCommitment

This commit is contained in:
Łukasz Magiera 2020-01-29 20:12:08 +01:00
parent c9c437cb3b
commit 25f544f3db

View File

@ -5,6 +5,7 @@ import (
"context"
"io"
"math"
"math/bits"
"math/rand"
"runtime"
"sync"
@ -18,6 +19,8 @@ import (
)
func (m *Sealing) fastPledgeCommitment(size uint64, parts uint64) (commP [sectorbuilder.CommLen]byte, err error) {
parts = 1 << bits.Len64(parts) // round down to nearest power of 2
piece := sectorbuilder.UserBytesForSectorSize((size/127 + size) / parts)
out := make([]sectorbuilder.PublicPieceInfo, parts)
var lk sync.Mutex