///
import { P2P } from '@shardeum-foundation/lib-types';
import { NodeStatus, SignedObject } from '@shardeum-foundation/lib-types/build/src/p2p/P2PTypes';
import * as events from 'events';
import * as network from '../network';
import Shardus from '../shardus';
export declare const emitter: events.EventEmitter;
export declare let id: string;
export declare let isFirst: boolean;
export declare let isActive: boolean;
/** This flag shows that our node has failed and should not be in the network
* It could even be that the node has restart but is still in the active list
* and waiting to be removed first before it can join again
*/
export declare let isFailed: boolean;
export declare let allowConnectionToFirstNode: boolean;
export declare let ip: string;
export declare let port: number;
export declare let isRestartNetwork: boolean;
export declare let p2pJoinTime: number;
export declare let p2pSyncStart: number;
export declare let p2pSyncEnd: number;
export declare let p2pIgnoreJoinRequests: boolean;
/** ROUTES */
/** FUNCTIONS */
export declare function init(): void;
export declare function startupV2(shardus: Shardus): Promise;
/**
* should deprecate this!
* @param activeNodes
* @returns
*/
export interface StatusHistoryEntry {
/**
* The status of the node taken from the module variable `state`.
*/
moduleStatus: P2P.P2PTypes.NodeStatus;
/**
* The status of the node taken from the node list, which ends up being the previous status before the update.
*/
nodeListStatus: P2P.P2PTypes.NodeStatus;
timestamp: number;
isoDateTime: string;
newestCycleCounter: number;
quarter: number;
uptime: string;
/**
* The optional argument to updateNodeState() explaining why or from where the state is being changed.
*/
because: string;
}
export declare function getStatusHistoryCopy(): StatusHistoryEntry[];
export declare function updateNodeState(updatedState: NodeStatus, because?: string): void;
export declare function contactArchiver(dbgContex: string): Promise;
export declare function getFullNodesFromArchiver(archiver?: P2P.SyncTypes.ActiveNode): Promise>;
export declare function getLatestCyclesFromArchiver(cycleCounter: number, archiver?: P2P.SyncTypes.ActiveNode): Promise;
export type NodeInfo = {
id: string;
publicKey: string;
curvePublicKey: string;
} & network.IPInfo & {
status: P2P.P2PTypes.NodeStatus;
};
export declare function getPublicNodeInfo(reportIntermediateStatus?: boolean): NodeInfo;
export declare function getThisNodeInfo(): P2P.P2PTypes.P2PNode;
export declare function setActive(): void;
export declare function setp2pIgnoreJoinRequests(value: boolean): void;
export declare function setIsFirst(val: boolean): void;
export declare function getIsFirst(): boolean;
export declare function setRestartNetwork(val: boolean): void;
/**
* Wait for currentQuarter to equal 1 and q1SendRequests to be true
*
* q1SendRequests is a flag that has a slight delay at the start of q1 to make sure
* that requests are not impacted by timestamp variation which could cause half of the network
* to think it is still Q4
* @returns
*/
export declare function waitForQ1SendRequests(): Promise;