Update sectorbuilder
This commit is contained in:
parent
591ea245bc
commit
b001a73da1
3
utils.go
3
utils.go
@ -49,6 +49,9 @@ func fillersFromRem(toFill uint64) ([]uint64, error) {
|
|||||||
|
|
||||||
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
|
parts = 1 << bits.Len64(parts) // round down to nearest power of 2
|
||||||
|
if size / parts < 127 {
|
||||||
|
parts = size / 127
|
||||||
|
}
|
||||||
|
|
||||||
piece := sectorbuilder.UserBytesForSectorSize((size + size / 127) / parts)
|
piece := sectorbuilder.UserBytesForSectorSize((size + size / 127) / parts)
|
||||||
out := make([]sectorbuilder.PublicPieceInfo, parts)
|
out := make([]sectorbuilder.PublicPieceInfo, parts)
|
||||||
|
@ -52,4 +52,11 @@ func TestFastPledge(t *testing.T) {
|
|||||||
if _, err := s.fastPledgeCommitment(sectorbuilder.UserBytesForSectorSize(sz), 5); err != nil {
|
if _, err := s.fastPledgeCommitment(sectorbuilder.UserBytesForSectorSize(sz), 5); err != nil {
|
||||||
t.Fatalf("%+v", err)
|
t.Fatalf("%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sz = uint64(1024)
|
||||||
|
|
||||||
|
s = Sealing{sb: sbmock.NewMockSectorBuilder(0, sz)}
|
||||||
|
if _, err := s.fastPledgeCommitment(sectorbuilder.UserBytesForSectorSize(sz), 64); err != nil {
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user