use sigs.CheckBlockSignature

This commit is contained in:
vyzo 2020-05-14 19:29:36 +03:00
parent 432c69c616
commit 50e05ae1ba

View File

@ -200,15 +200,7 @@ func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub
}
}
blob, err := blk.Header.SigningBytes()
if err != nil {
// this shouldn't happen; it's an encoding error of the object we just decoded sans the
// signature...
log.Errorf("error retrieving signing bytes for block header: %s", err)
return pubsub.ValidationIgnore
}
err = sigs.Verify(blk.Header.BlockSig, key, blob)
err = sigs.CheckBlockSignature(blk.Header, ctx, key)
if err != nil {
log.Errorf("block signature verification failed: %s", err)
recordFailure("signature_verification_failed")