mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
Update beacon/blsync/block_sync.go
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
fd70b19474
commit
9de80ca574
1 changed files with 11 additions and 12 deletions
|
|
@ -127,20 +127,19 @@ func (s *beaconBlockSync) updateEventFeed() {
|
||||||
|
|
||||||
var finalizedHash common.Hash
|
var finalizedHash common.Hash
|
||||||
if finality, ok := s.headTracker.ValidatedFinality(); ok {
|
if finality, ok := s.headTracker.ValidatedFinality(); ok {
|
||||||
if he, fe := head.Header.Epoch(), finality.Attested.Header.Epoch(); he == fe {
|
he := head.Header.Epoch()
|
||||||
|
fe := finality.Attested.Header.Epoch()
|
||||||
|
switch {
|
||||||
|
case he == fe:
|
||||||
finalizedHash = finality.Finalized.PayloadHeader.BlockHash()
|
finalizedHash = finality.Finalized.PayloadHeader.BlockHash()
|
||||||
} else {
|
case he < fe:
|
||||||
if he < fe {
|
return
|
||||||
return // finality proof arrived earlier, wait for head update
|
case he == fe+1:
|
||||||
}
|
parent, ok := s.recentBlocks.Get(head.Header.ParentRoot)
|
||||||
if he == fe+1 {
|
if !ok || parent.Slot()/params.EpochLength == fe {
|
||||||
if parent, ok := s.recentBlocks.Get(head.Header.ParentRoot); !ok ||
|
|
||||||
parent.Slot()/params.EpochLength == fe {
|
|
||||||
return // head is at first slot of next epoch, wait for finality update
|
return // head is at first slot of next epoch, wait for finality update
|
||||||
//TODO trt to fetch finality update directly if subscription does not deliver
|
//TODO trt to fetch finality update directly if subscription does not deliver
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue