post: Don't send empty posts
This commit is contained in:
parent
c8d23b5947
commit
262d7b2372
@ -3,6 +3,7 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
@ -17,6 +18,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var errNoPartitions = errors.New("no partitions")
|
||||||
|
|
||||||
func (s *WindowPoStScheduler) failPost(deadline *miner.DeadlineInfo) {
|
func (s *WindowPoStScheduler) failPost(deadline *miner.DeadlineInfo) {
|
||||||
log.Errorf("TODO")
|
log.Errorf("TODO")
|
||||||
/*s.failLk.Lock()
|
/*s.failLk.Lock()
|
||||||
@ -39,18 +42,20 @@ func (s *WindowPoStScheduler) doPost(ctx context.Context, deadline *miner.Deadli
|
|||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
proof, err := s.runPost(ctx, *deadline, ts)
|
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)
|
log.Errorf("runPost failed: %+v", err)
|
||||||
s.failPost(deadline)
|
s.failPost(deadline)
|
||||||
return
|
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())
|
log.Infof("ts: %+v (%d)", ts.Key(), ts.Height())
|
||||||
|
|
||||||
if partitionCount == 0 {
|
if partitionCount == 0 {
|
||||||
return nil, nil
|
return nil, errNoPartitions
|
||||||
}
|
}
|
||||||
|
|
||||||
partitions := make([]uint64, partitionCount)
|
partitions := make([]uint64, partitionCount)
|
||||||
|
Loading…
Reference in New Issue
Block a user