core: fix deadlock in headers list init
This probably is a problem since adc880d323
,
because AddHeaders() uses headersOp channel and its reader is only ran in
Run().
This commit is contained in:
parent
578ac414d4
commit
903173c991
1 changed files with 5 additions and 2 deletions
|
@ -148,8 +148,11 @@ func (bc *Blockchain) init() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
headerSliceReverse(headers)
|
headerSliceReverse(headers)
|
||||||
if err := bc.AddHeaders(headers...); err != nil {
|
for _, h := range headers {
|
||||||
return err
|
if !h.Verify() {
|
||||||
|
return fmt.Errorf("bad header %d/%s in the storage", h.Index, h.Hash())
|
||||||
|
}
|
||||||
|
bc.headerList.Add(h.Hash())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue