mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
les: fix serverHandler crash after setHead (#24200)
This commit is contained in:
parent
3ccd6b6dbb
commit
335914a63a
@ -421,7 +421,10 @@ func (h *serverHandler) broadcastLoop() {
|
||||
}
|
||||
var reorg uint64
|
||||
if lastHead != nil {
|
||||
reorg = lastHead.Number.Uint64() - rawdb.FindCommonAncestor(h.chainDb, header, lastHead).Number.Uint64()
|
||||
// If a setHead has been performed, the common ancestor can be nil.
|
||||
if ancestor := rawdb.FindCommonAncestor(h.chainDb, header, lastHead); ancestor != nil {
|
||||
reorg = lastHead.Number.Uint64() - ancestor.Number.Uint64()
|
||||
}
|
||||
}
|
||||
lastHead, lastTd = header, td
|
||||
log.Debug("Announcing block to peers", "number", number, "hash", hash, "td", td, "reorg", reorg)
|
||||
|
Loading…
Reference in New Issue
Block a user