Fix fast pledge math

This commit is contained in:
Łukasz Magiera 2020-01-30 02:01:10 +01:00
parent cb318cf2e9
commit 90b855094e
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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)
}
}