Merge pull request #1577 from filecoin-project/fix/dont-empty-post

post: Don't send empty posts
This commit is contained in:
Łukasz Magiera 2020-04-22 21:20:47 +02:00 committed by GitHub
commit 6b2b2b678f

View File

@ -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 {
log.Errorf("runPost failed: %+v", err) case errNoPartitions:
s.failPost(deadline)
return return
} case nil:
if err := s.submitPost(ctx, proof); err != nil { if err := s.submitPost(ctx, proof); err != nil {
log.Errorf("submitPost failed: %+v", err) log.Errorf("submitPost failed: %+v", err)
s.failPost(deadline) s.failPost(deadline)
return return
} }
default:
log.Errorf("runPost 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)