From 2e876b55934b664456f4d4cbd408fedf8ece45ff Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 16 Sep 2020 12:31:48 +0300 Subject: [PATCH] block: remove Base.Verify() It's a no-op and there is nothing we can do about it, header contents could only be checked against chain state, there is nothing to check for internal consistency. --- pkg/core/block/block_base.go | 6 ------ pkg/core/blockchain.go | 7 ------- 2 files changed, 13 deletions(-) diff --git a/pkg/core/block/block_base.go b/pkg/core/block/block_base.go index 259dcc4d5..2fb7b2e01 100644 --- a/pkg/core/block/block_base.go +++ b/pkg/core/block/block_base.go @@ -64,12 +64,6 @@ type baseAux struct { Witnesses []transaction.Witness `json:"witnesses"` } -// Verify verifies the integrity of the Base. -func (b *Base) Verify() bool { - // TODO: Need a persisted blockchain for this. - return true -} - // Hash returns the hash of the block. func (b *Base) Hash() util.Uint256 { if b.hash.Equals(util.Uint256{}) { diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 13266c65c..14e0b6aaa 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -264,9 +264,6 @@ func (bc *Blockchain) init() error { } headerSliceReverse(headers) for _, h := range headers { - if !h.Verify() { - return fmt.Errorf("bad header %d/%s in the storage", h.Index, h.Hash()) - } bc.headerList.Add(h.Hash()) } } @@ -506,10 +503,6 @@ func (bc *Blockchain) addHeaders(verify bool, headers ...*block.Header) (err err if int(h.Index) < headerList.Len() { continue } - if !h.Verify() { - err = fmt.Errorf("header %v is invalid", h) - return - } if err = bc.processHeader(h, batch, headerList); err != nil { return }