From 728d86cd3610664bb09592a72713a1ec59ec8ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 11 Mar 2021 09:59:26 +0100 Subject: [PATCH] wdpost: Always head tipset to get randomness --- storage/wdpost_run.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index afb56b13b33..fd7c4f184be 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -481,7 +481,12 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err) } - rand, err := s.api.ChainGetRandomnessFromBeacon(ctx, ts.Key(), 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) + } + + rand, 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) }