use cid for cmp

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-07-20 15:29:07 +02:00
parent 740499a726
commit e1c9c4297b
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -74,11 +74,6 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.Consen
// (0) cheap preliminary checks
// are blocks the same?
if bytes.Equal(a, b) {
return nil, fmt.Errorf("no consensus fault: submitted blocks are the same")
}
// can blocks be decoded properly?
var blockA, blockB types.BlockHeader
if decodeErr := blockA.UnmarshalCBOR(bytes.NewReader(a)); decodeErr != nil {
@ -89,6 +84,11 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.Consen
return nil, xerrors.Errorf("cannot decode second block header: %f", decodeErr)
}
// are blocks the same?
if blockA.Cid().Equals(blockB.Cid()) {
return nil, fmt.Errorf("no consensus fault: submitted blocks are the same")
}
// (1) check conditions necessary to any consensus fault
// were blocks mined by same miner?