post: Don't send empty posts

This commit is contained in:
Łukasz Magiera 2020-04-22 21:16:19 +02:00
parent c8d23b5947
commit 262d7b2372

View File

@ -3,6 +3,7 @@ package storage
import (
"bytes"
"context"
"errors"
"time"
"github.com/filecoin-project/go-address"
@ -17,6 +18,8 @@ import (
"github.com/filecoin-project/lotus/chain/types"
)
var errNoPartitions = errors.New("no partitions")
func (s *WindowPoStScheduler) failPost(deadline *miner.DeadlineInfo) {
log.Errorf("TODO")
/*s.failLk.Lock()
@ -39,18 +42,20 @@ func (s *WindowPoStScheduler) doPost(ctx context.Context, deadline *miner.Deadli
defer span.End()
proof, err := s.runPost(ctx, *deadline, ts)
if err != nil {
switch err {
case errNoPartitions:
return
case nil:
if err := s.submitPost(ctx, proof); err != nil {
log.Errorf("submitPost failed: %+v", err)
s.failPost(deadline)
return
}
default:
log.Errorf("runPost failed: %+v", err)
s.failPost(deadline)
return
}
if err := s.submitPost(ctx, proof); err != nil {
log.Errorf("submitPost failed: %+v", err)
s.failPost(deadline)
return
}
}()
}
@ -114,7 +119,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo
log.Infof("ts: %+v (%d)", ts.Key(), ts.Height())
if partitionCount == 0 {
return nil, nil
return nil, errNoPartitions
}
partitions := make([]uint64, partitionCount)