Fix candidate check

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2019-12-12 14:12:43 +01:00
parent 5537cc3444
commit 344dd2ca5a
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -513,6 +513,10 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
snum := types.BigDiv(mpow, types.NewInt(ssize))
if len(h.EPostProof.Candidates) == 0 {
return xerrors.Errorf("no candidates")
}
for _, t := range h.EPostProof.Candidates {
if !types.IsTicketWinner(t.Partial, ssize, snum.Uint64(), tpow) {
return xerrors.Errorf("miner created a block but was not a winner")