Skip to content

Commit

Permalink
add getId to CheckpointHeaderRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Aug 19, 2024
1 parent b836ce5 commit d2c4626
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {DatabaseController, Repository} from "@lodestar/db";
import {LightClientHeader, ssz} from "@lodestar/types";
import {Bucket, getBucketNameByValue} from "../buckets.js";
import {getLightClientHeaderTypeFromBytes} from "../../util/multifork.js";
import { ValueOfFields, ContainerType, UintNumberType, ByteVectorType, ByteListType, UintBigintType, VectorCompositeType } from "@chainsafe/ssz";
import { ExecutionAddressType } from "@lodestar/types/lib/utils/executionAddress.js";

/**
* Block headers by block root. Until finality includes all headers seen by this node. After finality,
Expand All @@ -25,4 +27,8 @@ export class CheckpointHeaderRepository extends Repository<Uint8Array, LightClie
decodeValue(data: Uint8Array): LightClientHeader {
return getLightClientHeaderTypeFromBytes(this.config, data).deserialize(data);
}

getId(value: LightClientHeader): Uint8Array {
return this.config.getLightClientForkTypes(value.beacon.slot).LightClientHeader.hashTreeRoot(value);
}
}

0 comments on commit d2c4626

Please sign in to comment.