From c8ae86e1f89dbbd6ade9c613d6bc4c9da0a0527a Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 18 Jun 2023 14:48:37 +0200 Subject: [PATCH] fix(validator): abortable sleep in prepareForNextEpoch --- packages/validator/src/services/attestationDuties.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/validator/src/services/attestationDuties.ts b/packages/validator/src/services/attestationDuties.ts index 916c02f91994..8762c4258ce0 100644 --- a/packages/validator/src/services/attestationDuties.ts +++ b/packages/validator/src/services/attestationDuties.ts @@ -108,14 +108,14 @@ export class AttestationDutiesService { * If a reorg dependent root comes at a slot other than last slot of epoch * just update this.pendingDependentRootByEpoch() and process here */ - private prepareForNextEpoch = async (slot: Slot): Promise => { + private prepareForNextEpoch = async (slot: Slot, signal: AbortSignal): Promise => { // only interested in last slot of epoch if ((slot + 1) % SLOTS_PER_EPOCH !== 0) { return; } // during the 1 / 3 of epoch, last block of epoch may come - await sleep(this.clock.msToSlot(slot + 1 / 3)); + await sleep(this.clock.msToSlot(slot + 1 / 3), signal); const nextEpoch = computeEpochAtSlot(slot) + 1; const dependentRoot = this.dutiesByIndexByEpoch.get(nextEpoch)?.dependentRoot;