Fix fast pledge math
This commit is contained in:
parent
cb318cf2e9
commit
90b855094e
2
utils.go
2
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
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user