From 2c0ed62680549ad753d5773752de4831f1bdb2ee Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 29 Nov 2019 14:22:31 +0300 Subject: [PATCH] core: fix blockchain init with (2000*N + 1) header hashes in DB Stored header count includes block number zero, so it's (height + 1). --- pkg/core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 2e589ca29..21d5ebb5f 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -150,7 +150,7 @@ func (bc *Blockchain) init() error { // There is a high chance that the Node is stopped before the next // batch of 2000 headers was stored. Via the currentHeaders stored we can sync // that with stored blocks. - if currHeaderHeight > bc.storedHeaderCount { + if currHeaderHeight >= bc.storedHeaderCount { hash := currHeaderHash var targetHash util.Uint256 if bc.headerList.Len() > 0 {