core: drop another useless genesis-specific header handling branch

If we only have genesis block (or <2000 headers) then we might as well use
generic logic below with zero targetHash because genesis block has zero
PrevHash (and its hash will naturally be the last on the chain going
backwards).
This commit is contained in:
Roman Khimov 2022-11-18 23:01:33 +03:00
parent 83e2ca054f
commit 16db4746cc

View file

@ -434,13 +434,6 @@ func (bc *Blockchain) init() error {
var targetHash util.Uint256 var targetHash util.Uint256
if len(bc.headerHashes) > 0 { if len(bc.headerHashes) > 0 {
targetHash = bc.headerHashes[len(bc.headerHashes)-1] targetHash = bc.headerHashes[len(bc.headerHashes)-1]
} else {
genesisBlock, err := CreateGenesisBlock(bc.config)
if err != nil {
return err
}
targetHash = genesisBlock.Hash()
bc.headerHashes = append(bc.headerHashes, targetHash)
} }
headers := make([]util.Uint256, 0, headerBatchCount) headers := make([]util.Uint256, 0, headerBatchCount)