From 65002190b834c5a31c5c8ca1dcf0f5953f83594d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 16 Sep 2023 11:12:18 -0400 Subject: [PATCH] fix: if we are within 1 period of getCurrentPeriod manually call sync actions, otherwise call parent sync --- src/client/client.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index 42c601f..7338aa3 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -50,10 +50,14 @@ export default class Client extends BaseClient { checkpoint.attestedHeader.beacon.slot, ); this.latestCommittee = checkpoint.nextSyncCommittee.pubkeys; - this.booted = true; - this.emit("synced"); + if (this._latestPeriod + 1 === this.getCurrentPeriod()) { + this.booted = true; + this.emit("synced"); - await this.getLatestExecution(false); + await this.getLatestExecution(false); + } else { + await super.sync(); + } } public async rpcCall(method: string, params: any) {