@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
14 lines • 629 B
JavaScript
import { encodeKey } from "@lodestar/db";
import { intToBytes } from "@lodestar/utils";
import { Bucket, getBucketNameByValue } from "../buckets.js";
const bucketId = getBucketNameByValue(Bucket.index_stateArchiveRootIndex);
export function getRootIndex(db, stateRoot) {
return db.get(getRootIndexKey(stateRoot), { bucketId });
}
export function storeRootIndex(db, slot, stateRoot) {
return db.put(getRootIndexKey(stateRoot), intToBytes(slot, 8, "be"), { bucketId });
}
export function getRootIndexKey(root) {
return encodeKey(Bucket.index_stateArchiveRootIndex, root);
}
//# sourceMappingURL=stateArchiveIndex.js.map