mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 12:40:05 +00:00
fix nil block (#2638)
This commit is contained in:
parent
85ef099360
commit
d43ea74244
@ -278,19 +278,21 @@ func (c *ChainService) runStateTransition(
|
||||
}
|
||||
// Prune the block cache on every new finalized epoch.
|
||||
if newState.FinalizedEpoch > finalizedEpoch {
|
||||
blockRoot, err := hashutil.HashBeaconBlock(block)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if block != nil {
|
||||
blockRoot, err := hashutil.HashBeaconBlock(block)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stateRoot, err := hashutil.HashProto(beaconState)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.p2p.Broadcast(ctx, &pb.FinalizedStateAnnounce{
|
||||
BlockRoot: blockRoot[:],
|
||||
StateRoot: stateRoot[:],
|
||||
Slot: beaconState.Slot,
|
||||
})
|
||||
}
|
||||
stateRoot, err := hashutil.HashProto(beaconState)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.p2p.Broadcast(ctx, &pb.FinalizedStateAnnounce{
|
||||
BlockRoot: blockRoot[:],
|
||||
StateRoot: stateRoot[:],
|
||||
Slot: beaconState.Slot,
|
||||
})
|
||||
c.beaconDB.ClearBlockCache()
|
||||
}
|
||||
log.WithField(
|
||||
|
Loading…
Reference in New Issue
Block a user