From d1e678aecd8e47b8b73561b9370fea37052dc84d Mon Sep 17 00:00:00 2001 From: okilisan Date: Fri, 23 Aug 2024 23:51:34 +0200 Subject: [PATCH] align with rusty block version test --- .../blockvalidator/block_header_in_isolation.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/domain/consensus/processes/blockvalidator/block_header_in_isolation.go b/domain/consensus/processes/blockvalidator/block_header_in_isolation.go index 6266ab1bc1..26e1399f4d 100644 --- a/domain/consensus/processes/blockvalidator/block_header_in_isolation.go +++ b/domain/consensus/processes/blockvalidator/block_header_in_isolation.go @@ -65,14 +65,12 @@ func (v *blockValidator) checkBlockVersion(header externalapi.BlockHeader) error ruleerrors.ErrWrongBlockVersion, "The block version should be %d", constants.BlockVersion) } */ - if header.DAAScore() >= v.hfDAAScore { - if header.Version() != constants.BlockVersionKHashV2 { - log.Warnf("After HF1 the block version should be %d - block[%d][v%d]", constants.BlockVersionKHashV2, header.DAAScore(), header.Version()) - } - } else { - if header.Version() != constants.BlockVersionKHashV1 { - log.Warnf("Before HF1 the block version should be %d - block[%d][v%d]", constants.BlockVersionKHashV1, header.DAAScore(), header.Version()) - } + if header.DAAScore() >= v.hfDAAScore && header.Version() != constants.BlockVersionKHashV2 { + log.Warnf("After HF1 the block version should be %d - block[%d][v%d]", constants.BlockVersionKHashV2, header.DAAScore(), header.Version()) + return errors.Wrapf(ruleerrors.ErrWrongBlockVersion, "The block version should be %d", constants.BlockVersionKHashV2) + } else if header.DAAScore() < v.hfDAAScore && header.Version() != constants.BlockVersionKHashV1 { + log.Warnf("Before HF1 the block version should be %d - block[%d][v%d]", constants.BlockVersionKHashV1, header.DAAScore(), header.Version()) + return errors.Wrapf(ruleerrors.ErrWrongBlockVersion, "The block version should be %d", constants.BlockVersionKHashV1) } return nil }