Skip to content

Commit

Permalink
Tested successfuly on local server
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Nov 11, 2022
1 parent eb90924 commit e7ae483
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/beacon/routes/lightclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const routesData: RoutesData<Api> = {
getOptimisticUpdate: {url: "/eth/v1/beacon/light_client/optimistic_update", method: "GET"},
getFinalityUpdate: {url: "/eth/v1/beacon/light_client/finality_update", method: "GET"},
getBootstrap: {url: "/eth/v1/beacon/light_client/bootstrap/{block_root}", method: "GET"},
getCommitteeHash: {url: "/eth/v1/beacon/light_client/committe_hash", method: "GET"},
getCommitteeHash: {url: "/eth/v1/beacon/light_client/committee_hash", method: "GET"},
};

/* eslint-disable @typescript-eslint/naming-convention */
Expand Down
4 changes: 3 additions & 1 deletion packages/beacon-node/src/api/impl/lightclient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export function getLightclientApi(
async getCommitteeHash(startPeriod: SyncPeriod, count: number) {
const maxAllowedCount = Math.min(MAX_REQUEST_LIGHT_CLIENT_COMMITTEE_HASHES, count);
const periods = Array.from({length: maxAllowedCount}, (_ignored, i) => i + startPeriod);
const committeeHashes = await Promise.all(periods.map(chain.lightClientServer.getCommitteeHash));
const committeeHashes = await Promise.all(
periods.map((period) => chain.lightClientServer.getCommitteeHash(period))
);
return {data: committeeHashes};
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/lightClient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class LightClientServer {
*/
async getCommitteeHash(period: number): Promise<Uint8Array> {
const {attestedHeader} = await this.getUpdate(period);
const blockRoot = ssz.phase0.BeaconBlockHeader.serialize(attestedHeader);
const blockRoot = ssz.phase0.BeaconBlockHeader.hashTreeRoot(attestedHeader);

const syncCommitteeWitness = await this.db.syncCommitteeWitness.get(blockRoot);
if (!syncCommitteeWitness) {
Expand Down

0 comments on commit e7ae483

Please sign in to comment.