Use ProvingSet for GetSectorsForElectionPost
This commit is contained in:
parent
6098db4f51
commit
466f1d8cb9
@ -180,7 +180,7 @@ func GetMinerSectorSet(ctx context.Context, sm *StateManager, ts *types.TipSet,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetSectorsForElectionPost(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (*sectorbuilder.SortedPublicSectorInfo, error) {
|
func GetSectorsForElectionPost(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (*sectorbuilder.SortedPublicSectorInfo, error) {
|
||||||
sectors, err := GetMinerSectorSet(ctx, sm, ts, maddr)
|
sectors, err := GetMinerProvingSet(ctx, sm, ts, maddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to get sector set for miner: %w", err)
|
return nil, xerrors.Errorf("failed to get sector set for miner: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -78,13 +78,18 @@ func (s *seal) commit(t *testing.T, sb *sectorbuilder.SectorBuilder, done func()
|
|||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *seal) post(t *testing.T, sb *sectorbuilder.SectorBuilder) time.Time {
|
func post(t *testing.T, sb *sectorbuilder.SectorBuilder, seals ...seal) time.Time {
|
||||||
cSeed := [32]byte{0, 9, 2, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9}
|
cSeed := [32]byte{0, 9, 2, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9}
|
||||||
|
|
||||||
ssi := sectorbuilder.NewSortedPublicSectorInfo([]ffi.PublicSectorInfo{{
|
ppi := make([]ffi.PublicSectorInfo, len(seals))
|
||||||
SectorID: s.sid,
|
for i, s := range seals {
|
||||||
CommR: s.pco.CommR,
|
ppi[i] = ffi.PublicSectorInfo{
|
||||||
}})
|
SectorID: s.sid,
|
||||||
|
CommR: s.pco.CommR,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ssi := sectorbuilder.NewSortedPublicSectorInfo(ppi)
|
||||||
|
|
||||||
candndates, err := sb.GenerateEPostCandidates(ssi, cSeed, []uint64{})
|
candndates, err := sb.GenerateEPostCandidates(ssi, cSeed, []uint64{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -165,7 +170,7 @@ func TestSealAndVerify(t *testing.T) {
|
|||||||
|
|
||||||
commit := time.Now()
|
commit := time.Now()
|
||||||
|
|
||||||
genCandidiates := s.post(t, sb)
|
genCandidiates := post(t, sb, s)
|
||||||
|
|
||||||
epost := time.Now()
|
epost := time.Now()
|
||||||
|
|
||||||
@ -175,7 +180,7 @@ func TestSealAndVerify(t *testing.T) {
|
|||||||
t.Fatalf("%+v", err)
|
t.Fatalf("%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.post(t, sb)
|
post(t, sb, s)
|
||||||
|
|
||||||
fmt.Printf("PreCommit: %s\n", precommit.Sub(start).String())
|
fmt.Printf("PreCommit: %s\n", precommit.Sub(start).String())
|
||||||
fmt.Printf("Commit: %s\n", commit.Sub(precommit).String())
|
fmt.Printf("Commit: %s\n", commit.Sub(precommit).String())
|
||||||
@ -237,7 +242,7 @@ func TestSealPoStNoCommit(t *testing.T) {
|
|||||||
t.Fatalf("%+v", err)
|
t.Fatalf("%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
genCandidiates := s.post(t, sb)
|
genCandidiates := post(t, sb, s)
|
||||||
|
|
||||||
epost := time.Now()
|
epost := time.Now()
|
||||||
|
|
||||||
@ -302,6 +307,8 @@ func TestSealAndVerify2(t *testing.T) {
|
|||||||
go s1.commit(t, sb, wg.Done)
|
go s1.commit(t, sb, wg.Done)
|
||||||
go s2.commit(t, sb, wg.Done)
|
go s2.commit(t, sb, wg.Done)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
post(t, sb, s1, s2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAcquireID(t *testing.T) {
|
func TestAcquireID(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user