@@ -216,15 +216,20 @@ export async function importBlock(
216
216
// Set head state as strong reference
217
217
this . regen . updateHeadState ( newHead , postState ) ;
218
218
219
- this . emitter . emit ( routes . events . EventType . head , {
220
- block : newHead . blockRoot ,
221
- epochTransition : computeStartSlotAtEpoch ( computeEpochAtSlot ( newHead . slot ) ) === newHead . slot ,
222
- slot : newHead . slot ,
223
- state : newHead . stateRoot ,
224
- previousDutyDependentRoot : this . forkChoice . getDependentRoot ( newHead , EpochDifference . previous ) ,
225
- currentDutyDependentRoot : this . forkChoice . getDependentRoot ( newHead , EpochDifference . current ) ,
226
- executionOptimistic : isOptimisticBlock ( newHead ) ,
227
- } ) ;
219
+ try {
220
+ this . emitter . emit ( routes . events . EventType . head , {
221
+ block : newHead . blockRoot ,
222
+ epochTransition : computeStartSlotAtEpoch ( computeEpochAtSlot ( newHead . slot ) ) === newHead . slot ,
223
+ slot : newHead . slot ,
224
+ state : newHead . stateRoot ,
225
+ previousDutyDependentRoot : this . forkChoice . getDependentRoot ( newHead , EpochDifference . previous ) ,
226
+ currentDutyDependentRoot : this . forkChoice . getDependentRoot ( newHead , EpochDifference . current ) ,
227
+ executionOptimistic : isOptimisticBlock ( newHead ) ,
228
+ } ) ;
229
+ } catch ( e ) {
230
+ // getDependentRoot() may fail with error: "No block for root" as we can see in holesky non-finality issue
231
+ this . logger . debug ( "Error emitting head event" , { slot : newHead . slot , root : newHead . blockRoot } , e as Error ) ;
232
+ }
228
233
229
234
const delaySec = this . clock . secFromSlot ( newHead . slot ) ;
230
235
this . logger . verbose ( "New chain head" , {
0 commit comments