sealing: round parts in fastPledgeCommitment
This commit is contained in:
parent
f6b12a33a2
commit
367062aee4
@ -5,6 +5,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
"math/bits"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
@ -18,6 +19,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (m *Sealing) fastPledgeCommitment(size uint64, parts uint64) (commP [sectorbuilder.CommLen]byte, err error) {
|
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)
|
piece := sectorbuilder.UserBytesForSectorSize((size/127 + size) / parts)
|
||||||
out := make([]sectorbuilder.PublicPieceInfo, parts)
|
out := make([]sectorbuilder.PublicPieceInfo, parts)
|
||||||
var lk sync.Mutex
|
var lk sync.Mutex
|
||||||
|
Loading…
Reference in New Issue
Block a user