diff --git a/utils.go b/utils.go index b235a8a83..21d6b76bf 100644 --- a/utils.go +++ b/utils.go @@ -50,7 +50,7 @@ func fillersFromRem(toFill uint64) ([]uint64, 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 / parts) + piece := sectorbuilder.UserBytesForSectorSize((size + size / 127) / parts) out := make([]sectorbuilder.PublicPieceInfo, parts) var lk sync.Mutex diff --git a/utils_test.go b/utils_test.go index 14d512a52..9f9ca3880 100644 --- a/utils_test.go +++ b/utils_test.go @@ -49,7 +49,7 @@ func TestFastPledge(t *testing.T) { sz := uint64(16 << 20) s := Sealing{sb: sbmock.NewMockSectorBuilder(0, sz)} - if _, err := s.fastPledgeCommitment(sz, 5); err != nil { + if _, err := s.fastPledgeCommitment(sectorbuilder.UserBytesForSectorSize(sz), 5); err != nil { t.Fatalf("%+v", err) } }