/** * `v2` houses some new state or functions introduced with Join Protocol v2. * TODO: Rename this module later? */ import { hexstring } from '@shardeum-foundation/lib-types'; import { JoinRequest } from '@shardeum-foundation/lib-types/build/src/p2p/JoinTypes'; /** Just a local convenience type. */ type publickey = JoinRequest['nodeInfo']['publicKey']; /** The list of nodes that are currently on standby. */ export declare const standbyNodesInfo: Map; export declare const standbyNodesInfoHashes: Map; /** This list is a map of standby node public keys to refreshed time in seconds */ export declare const standbyNodesRefresh: Map; export declare function init(): void; export declare function deleteStandbyNodeFromMap(key: publickey): boolean; /** * Pushes the join request onto the list of new join requests. Its node's info * will be added to the standby node list at the end of the cycle during cycle * digestion. * * @param joinRequest The join request to save. * @param persistImmediately If true, the node will be added to the standby node list immediately. This can be used for the first node in the network. */ export declare function saveJoinRequest(joinRequest: JoinRequest, persistImmediately?: boolean): void; /** * Returns the list of new standby join requests and empties the list. */ export declare function drainNewJoinRequests(): JoinRequest[]; /** * Adds nodes to the standby node list. */ export declare function addStandbyJoinRequests(nodes: JoinRequest[], logErrors?: boolean): void; /** * Returns the list of standby nodes, sorted by their public keys. */ export declare function getSortedStandbyJoinRequests(): JoinRequest[]; /** Calculates and returns a hash based on the list of standby nodes, sorted by public key. This will also update the recorded `lastHashedList` of nodes, which can be retrieved via `getLastHashedStandbyList`. */ export declare function computeNewStandbyListHash(): hexstring; /** * Returns the standby node list hash from the last complete cycle, if available. If you * want to compute a new hash instead, use `computeNewStandbyListHash`. */ export declare function getStandbyListHash(): hexstring | undefined; /** * Returns the txList hash from the last complete cycle, if available */ export declare function getTxListHash(): hexstring | undefined; /** Returns the last list of standby information that had its hash computed. */ export declare function getLastHashedStandbyList(): JoinRequest[]; /** Returns the map of standby information. */ export declare function getStandbyNodesInfoMap(): Map; export declare function updateStandbyRefreshCounter(updatedJoinRequest: JoinRequest): void; export declare function isOnStandbyList(publicKey: string): boolean; export declare function debugDumpJoinRequestList(list: JoinRequest[], message: string): void; /** * Handles unjoining from the network. */ export declare function shutdown(): Promise; export {};