Skip to content

Commit

Permalink
wdpost: Use chain head tsk in post rand check
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Mar 10, 2021
1 parent ca3d226 commit a0d7604
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion storage/wdpost_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,12 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
return nil, xerrors.Errorf("received no proofs back from generate window post")
}

checkRand, err := s.api.ChainGetRandomnessFromBeacon(ctx, types.EmptyTSK, crypto.DomainSeparationTag_WindowedPoStChallengeSeed, di.Challenge, buf.Bytes())
headTs, err := s.api.ChainHead(ctx)
if err != nil {
return nil, xerrors.Errorf("getting current head: %w", err)
}

checkRand, err := s.api.ChainGetRandomnessFromBeacon(ctx, headTs.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, di.Challenge, buf.Bytes())
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness from beacon for window post (ts=%d; deadline=%d): %w", ts.Height(), di, err)
}
Expand Down
2 changes: 1 addition & 1 deletion storage/wdpost_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func (m *mockStorageMinerAPI) GasEstimateMessageGas(ctx context.Context, message
}

func (m *mockStorageMinerAPI) ChainHead(ctx context.Context) (*types.TipSet, error) {
panic("implement me")
return nil, nil
}

func (m *mockStorageMinerAPI) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error) {
Expand Down

0 comments on commit a0d7604

Please sign in to comment.