From ec8402714f6f9c7ec405c465ea6cc965eabacad5 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 16 Sep 2023 00:39:38 -0400 Subject: [PATCH] fix: if startPeriod is greater than genesisPeriod, try to use latestCommittee falling back to genesisCommittee --- src/baseClient.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/baseClient.ts b/src/baseClient.ts index 26f34b1..8d22b0c 100644 --- a/src/baseClient.ts +++ b/src/baseClient.ts @@ -304,7 +304,10 @@ export default abstract class BaseClient extends EventEmitter { startPeriod = this.latestPeriod, ): Promise { const currentPeriod = this.getCurrentPeriod(); - let startCommittee = this.genesisCommittee; + let startCommittee = + startPeriod > this.genesisPeriod + ? this.latestCommittee ?? this.genesisCommittee + : this.genesisCommittee; console.debug( `Sync started from period(${startPeriod}) to period(${currentPeriod})`, );