mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-24 09:25:21 +00:00
core: fix potential issue with header list init
If we're to receive some 500 headers (less than `headerBatchCount`) and quit before receiving more of them we end up with clean `bc.headerList` that will be inited going backwards to the `targetHash`, but code path doesn't add add the `targetHash` itself which it should do in this particular case, otherwise we end with no genesis block hash in the list.
This commit is contained in:
parent
b5199625cd
commit
c567307748
1 changed files with 1 additions and 1 deletions
|
@ -153,6 +153,7 @@ func (bc *Blockchain) init() error {
|
|||
return err
|
||||
}
|
||||
targetHash = genesisBlock.Hash()
|
||||
bc.headerList.Add(targetHash)
|
||||
}
|
||||
headers := make([]*Header, 0)
|
||||
|
||||
|
@ -164,7 +165,6 @@ func (bc *Blockchain) init() error {
|
|||
headers = append(headers, header)
|
||||
hash = header.PrevHash
|
||||
}
|
||||
|
||||
headerSliceReverse(headers)
|
||||
for _, h := range headers {
|
||||
if !h.Verify() {
|
||||
|
|
Loading…
Reference in a new issue