import type { Chain } from '../blockchain/index.ts'; import type { Config } from '../config.ts'; import type { Peer } from '../net/peer/peer.ts'; import type { PeerPool } from '../net/peerpool.ts'; import type { AccountFetcher, BlockFetcher, ReverseBlockFetcher } from './fetcher/index.ts'; export interface SynchronizerOptions { config: Config; pool: PeerPool; chain: Chain; interval?: number; } /** * Base class for blockchain synchronizers * @memberof module:sync */ export declare abstract class Synchronizer { config: Config; protected pool: PeerPool; protected chain: Chain; protected interval: number; protected forceSync: boolean; _fetcher: AccountFetcher | BlockFetcher | ReverseBlockFetcher | null; opened: boolean; running: boolean; startingBlock: bigint; private SYNCED_STATE_REMOVAL_PERIOD; private _syncedStatusCheckInterval; /** * Create new node */ constructor(options: SynchronizerOptions); /** * Returns synchronizer type */ get type(): string; get fetcher(): AccountFetcher | BlockFetcher | ReverseBlockFetcher | null; set fetcher(fetcher: AccountFetcher | BlockFetcher | ReverseBlockFetcher | null); /** * Open synchronizer. Must be called before sync() is called */ open(): Promise; /** * Returns true if peer can be used for syncing */ syncable(_peer: Peer): boolean; /** * Start synchronization */ start(): Promise; abstract best(): Promise; abstract syncWithPeer(peer?: Peer): Promise; resolveSync(height?: bigint): boolean; syncWithFetcher(): Promise; /** * Fetch all blocks from current height up to highest found amongst peers * @returns when sync is completed */ sync(): Promise; /** * Clears and removes the fetcher. */ clearFetcher(): void; /** * Stop synchronizer. */ stop(): Promise; /** * Close synchronizer. */ close(): Promise; /** * Reset synced status after a certain time with no chain updates */ _syncedStatusCheck(): void; } //# sourceMappingURL=sync.d.ts.map