Skip to content

Commit

Permalink
Improve LightClientIniter onFinalized (#3174)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Sep 15, 2021
1 parent 54b95c2 commit 0338012
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/lodestar/src/chain/lightClient/LightClientIniter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {SLOTS_PER_EPOCH, SYNC_COMMITTEE_SIZE} from "@chainsafe/lodestar-params";
import {Epoch, phase0} from "@chainsafe/lodestar-types";
import {IChainForkConfig} from "@chainsafe/lodestar-config";
import {computeSyncPeriodAtEpoch} from "@chainsafe/lodestar-beacon-state-transition";
// eslint-disable-next-line no-restricted-imports
import {computeWeakSubjectivityPeriod} from "@chainsafe/lodestar-beacon-state-transition/lib/allForks/util/weakSubjectivity";
import {allForks} from "@chainsafe/lodestar-beacon-state-transition";
import {ForkChoice} from "@chainsafe/lodestar-fork-choice";
import {IBeaconDb} from "../../db";
import {StateContextCache} from "../stateCache";
Expand Down Expand Up @@ -131,7 +130,7 @@ export class LightClientIniter {
};

// calculate beginning of weak subjectivity period to prune from there
const wsPeriod = computeWeakSubjectivityPeriod(this.config, finalizedState);
const wsPeriod = allForks.computeWeakSubjectivityPeriodCachedState(this.config, finalizedState);
const wsEpoch = Math.max(0, finalizedBlockEpoch - wsPeriod);
const wsSyncPeriod = computeSyncPeriodAtEpoch(wsEpoch);

Expand Down

0 comments on commit 0338012

Please sign in to comment.