@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
19 lines (15 loc) • 679 B
text/typescript
import {Epoch, ValidatorIndex} from "@lodestar/types";
import {SeenAttesters} from "./seenAttesters.js";
// TODO abstract out the Seen* caches into an abstract abstract data structure
// that all the caches can extend since they share similar structure.
export class SeenBlockAttesters extends SeenAttesters {
addIndices(epoch: Epoch, validatorIndexes: ValidatorIndex[]): void {
if (epoch < this.lowestPermissibleEpoch) {
throw Error(`EpochTooLow ${epoch} < ${this.lowestPermissibleEpoch}`);
}
const indexesByEpoch = this.validatorIndexesByEpoch.getOrDefault(epoch);
for (const index of validatorIndexes) {
indexesByEpoch.add(index);
}
}
}