lpwindow: Mostly done proper Do

This commit is contained in:
Łukasz Magiera
2023-10-27 16:10:55 +02:00
parent a5a0bd378e
commit 2b405f433c
7 changed files with 655 additions and 20 deletions
+8 -3
View File
@@ -647,6 +647,10 @@ func (l *LocalWorker) GenerateWinningPoSt(ctx context.Context, ppt abi.Registere
}
func (l *LocalWorker) GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) {
return l.GenerateWindowPoStAdv(ctx, ppt, mid, sectors, partitionIdx, randomness, false)
}
func (l *LocalWorker) GenerateWindowPoStAdv(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness, allowSkip bool) (storiface.WindowPoStResult, error) {
sb, err := l.executor()
if err != nil {
return storiface.WindowPoStResult{}, err
@@ -658,7 +662,7 @@ func (l *LocalWorker) GenerateWindowPoSt(ctx context.Context, ppt abi.Registered
var wg sync.WaitGroup
wg.Add(len(sectors))
vproofs := make([][]byte, len(sectors))
vproofs := make([][]byte, 0, len(sectors))
for i, s := range sectors {
if l.challengeThrottle != nil {
@@ -696,12 +700,13 @@ func (l *LocalWorker) GenerateWindowPoSt(ctx context.Context, ppt abi.Registered
return
}
vproofs[i] = vanilla
//vproofs[i] = vanilla // todo substitutes??
vproofs = append(vproofs, vanilla)
}(i, s)
}
wg.Wait()
if len(skipped) > 0 {
if len(skipped) > 0 && !allowSkip {
// This should happen rarely because before entering GenerateWindowPoSt we check all sectors by reading challenges.
// When it does happen, window post runner logic will just re-check sectors, and retry with newly-discovered-bad sectors skipped
log.Errorf("couldn't read some challenges (skipped %d)", len(skipped))