From c8cef1cb7e072677a424faeceef079757656ac5e Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Tue, 1 Jun 2021 13:13:45 -0400 Subject: [PATCH] Fix chain/gen randomness getting (test only) --- chain/gen/gen.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 319b7ac29..0cbdb2188 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -590,6 +590,10 @@ func (mca mca) ChainGetRandomnessFromTickets(ctx context.Context, tsk types.TipS return nil, xerrors.Errorf("loading tipset key: %w", err) } + if randEpoch > build.UpgradeHyperdriveHeight { + return mca.sm.ChainStore().GetChainRandomnessLookingForward(ctx, pts.Cids(), personalization, randEpoch, entropy) + } + return mca.sm.ChainStore().GetChainRandomnessLookingBack(ctx, pts.Cids(), personalization, randEpoch, entropy) } @@ -599,6 +603,10 @@ func (mca mca) ChainGetRandomnessFromBeacon(ctx context.Context, tsk types.TipSe return nil, xerrors.Errorf("loading tipset key: %w", err) } + if randEpoch > build.UpgradeHyperdriveHeight { + return mca.sm.ChainStore().GetBeaconRandomnessLookingForward(ctx, pts.Cids(), personalization, randEpoch, entropy) + } + return mca.sm.ChainStore().GetBeaconRandomnessLookingBack(ctx, pts.Cids(), personalization, randEpoch, entropy) }