fix: if startPeriod is greater than genesisPeriod, try to use latestCommittee falling back to genesisCommittee

This commit is contained in:
Derrick Hammer 2023-09-16 00:39:38 -04:00
parent 908d508c05
commit ec8402714f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 1 deletions

View File

@ -304,7 +304,10 @@ export default abstract class BaseClient extends EventEmitter {
startPeriod = this.latestPeriod, startPeriod = this.latestPeriod,
): Promise<Uint8Array[]> { ): Promise<Uint8Array[]> {
const currentPeriod = this.getCurrentPeriod(); const currentPeriod = this.getCurrentPeriod();
let startCommittee = this.genesisCommittee; let startCommittee =
startPeriod > this.genesisPeriod
? this.latestCommittee ?? this.genesisCommittee
: this.genesisCommittee;
console.debug( console.debug(
`Sync started from period(${startPeriod}) to period(${currentPeriod})`, `Sync started from period(${startPeriod}) to period(${currentPeriod})`,
); );