From b96da09a5d53043cc4b80a5b0d20243b45c6c7b8 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 12 Dec 2019 14:24:24 +0100 Subject: [PATCH] Add additional checks License: MIT Signed-off-by: Jakub Sztandera --- chain/sync.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chain/sync.go b/chain/sync.go index 22f39eb8c..2ed52cdc5 100644 --- a/chain/sync.go +++ b/chain/sync.go @@ -642,6 +642,13 @@ func (syncer *Syncer) VerifyElectionPoStProof(ctx context.Context, h *types.Bloc SectorChallengeIndex: t.ChallengeIndex, }) } + // FORK START + if h.Height > build.ForkCCM { + if len(winners) == 0 { + return xerrors.Errorf("no candidates") + } + } + // FORK END sectorInfo, err := stmgr.GetSectorsForElectionPost(ctx, syncer.sm, baseTs, h.Miner) if err != nil { @@ -655,6 +662,7 @@ func (syncer *Syncer) VerifyElectionPoStProof(ctx context.Context, h *types.Bloc return xerrors.Errorf("[TESTING] election post was invalid") } hvrf := sha256.Sum256(h.EPostProof.PostRand) + ok, err := sectorbuilder.VerifyElectionPost(ctx, ssize, *sectorInfo, hvrf[:], h.EPostProof.Proof, winners, h.Miner) if err != nil { return xerrors.Errorf("failed to verify election post: %w", err)