From e1c9c4297bcd04ae15a2bdd00e6c30c689d16b27 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Mon, 20 Jul 2020 15:29:07 +0200 Subject: [PATCH] use cid for cmp Signed-off-by: Jakub Sztandera --- chain/vm/syscalls.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chain/vm/syscalls.go b/chain/vm/syscalls.go index 10632611a..887e138fd 100644 --- a/chain/vm/syscalls.go +++ b/chain/vm/syscalls.go @@ -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?