sync: Use correct epost randomness

This commit is contained in:
Łukasz Magiera 2020-03-04 06:32:33 +01:00
parent f50e26e5dd
commit 1d3877fab3

View File

@ -2,6 +2,7 @@ package chain
import ( import (
"context" "context"
"crypto/sha256"
"errors" "errors"
"fmt" "fmt"
"sync" "sync"
@ -722,8 +723,9 @@ func (syncer *Syncer) VerifyElectionPoStProof(ctx context.Context, h *types.Bloc
// TODO: why do we need this here? // TODO: why do we need this here?
challengeCount := sectorbuilder.ElectionPostChallengeCount(uint64(len(sectorInfo)), 0) challengeCount := sectorbuilder.ElectionPostChallengeCount(uint64(len(sectorInfo)), 0)
hvrf := sha256.Sum256(h.EPostProof.PostRand)
pvi := abi.PoStVerifyInfo{ pvi := abi.PoStVerifyInfo{
Randomness: h.EPostProof.PostRand, Randomness: hvrf[:],
Candidates: candidates, Candidates: candidates,
Proofs: h.EPostProof.Proofs, Proofs: h.EPostProof.Proofs,
EligibleSectors: sectorInfo, EligibleSectors: sectorInfo,
@ -737,6 +739,7 @@ func (syncer *Syncer) VerifyElectionPoStProof(ctx context.Context, h *types.Bloc
} }
if !ok { if !ok {
log.Errorf("invalid election post (%x; %v)", pvi.Randomness, candidates)
return xerrors.Errorf("election post was invalid") return xerrors.Errorf("election post was invalid")
} }