@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
39 lines • 1.53 kB
TypeScript
import { Epoch, Slot } from "@lodestar/types";
import { Batch } from "../batch.js";
/**
* Validates that the status and ordering of batches is valid
* ```
* [AwaitingValidation]* [Processing]? [AwaitingDownload,Downloading,AwaitingProcessing]*
* ```
*/
export declare function validateBatchesStatus(batches: Batch[]): void;
/**
* Return the next batch to process if any.
* @see validateBatchesStatus for batches state description
*/
export declare function getNextBatchToProcess(batches: Batch[]): Batch | null;
/**
* Compute the startEpoch of the next batch to be downloaded
*/
export declare function toBeDownloadedStartEpoch(batches: Batch[], startEpoch: Epoch): Epoch;
export declare function toArr<K, V>(map: Map<K, V>): V[];
export declare function getBatchSlotRange(startEpoch: Epoch): {
startSlot: number;
count: number;
};
/**
* Given a batch's startEpoch, return true if batch does not include slot and is strictly after
* ```
* Batch1 Batch2 Batch3
* ----|--------|-----X--|--------|---
* ```
* - Batch1 = not includes and before = false
* - Batch2 = includes = false
* - Batch3 = not includes and after = true
*/
export declare function batchStartEpochIsAfterSlot(startEpoch: Epoch, targetSlot: Slot): boolean;
/**
* Returns true if SyncChain has processed all possible blocks with slot <= target.slot
*/
export declare function isSyncChainDone(batches: Batch[], lastEpochWithProcessBlocks: Epoch, targetSlot: Slot): boolean;
//# sourceMappingURL=batches.d.ts.map