/// <reference types="node" />
import { ILogger } from "@node-lightning/logger";
import { IWireMessage } from "../messages/IWireMessage";
import { Peer } from "../Peer";
import { GossipFilter } from "../gossip/GossipFilter";
import { SyncState } from "../gossip/GossipManager";
import { GossipPeer } from "./GossipPeer";
import { IGossipFilterChainClient } from "../gossip/IGossipFilterChainClient";
import { IGossipRelay } from "./GossipRelay";
import { DnsPeerQuery } from "../gossip/DnsPeerQuery";
import { BitField, OutPoint, ShortChannelId } from "@node-lightning/core";
export declare class PeerGossipState {
    gossipRelay: boolean;
}
/**
 * GossipManager provides is a facade for many parts of gossip. It
 * orchestrates for validating, storing, and emitting
 * routing gossip traffic obtained by peers.
 */
export declare class GossipManager {
    readonly gossipFilter: GossipFilter;
    readonly chainClient?: IGossipFilterChainClient;
    blockHeight: number;
    started: boolean;
    syncState: SyncState;
    isSynchronizing: boolean;
    gossipRelay: IGossipRelay;
    dnsPeerQuery: DnsPeerQuery;
    protected logger: ILogger;
    protected peers: Map<string, GossipPeer>;
    constructor(logger: ILogger, gossipFilter: GossipFilter, chainClient?: IGossipFilterChainClient);
    /**
     * Starts the gossip manager. This method will load information
     * from the gossip store, determine when the last information
     * was obtained, validate the existing messages (to see if any
     * channels have closed), and finally emit all messages that
     * exist in the system.
     */
    start(): Promise<void>;
    onPeerReady(peer: Peer): void;
    /**
     * Handles when a peer closes
     * @param gossipPeer
     */
    onPeerClose(peer: Peer): void;
    /**
     * TODO: Refactor this out of here. It should be part of the PeerManager!
     * Uses a dns seed to discover and add peers to be managed by the GossipManager.
     */
    bootstrapPeers(ls: Buffer, localFeatures: BitField<any>, localChains: Buffer[], logger: ILogger, dnsSeed: string): Promise<void>;
    /**
     * TODO: Refactor this. It should be event based, not imperative.
     *  Removes the channel from storage by the gossip manager. This
     * will likely be called by a chain-monitoring service.
     */
    removeChannel(scid: ShortChannelId): Promise<void>;
    /**
     * TODO: Refactor this. It should be event based, not imperative.
     * Removes the channel from storage by the gossip manager. This will
     * likely be called by a chain-monitoring service.
     * @param outpoint
     */
    removeChannelByOutpoint(outpoint: OutPoint): Promise<void>;
    /**
     * TODO: Refactor this. It should be event based, not imperative.
     * Retrieves the valid chan_ann, chan_update, node_ann messages
     * while making sure to not send duplicate node_ann messages.
     *
     * @remarks
     * For now we are going to buffer messages into memory. We could
     * return a stream and yield messages as they are streamed from
     * the gossip_store.
     */
    allMessages(): AsyncGenerator<IWireMessage, void, unknown>;
    findPeer(peer: Peer): GossipPeer;
    handlePeerMessage(peer: Peer, msg: IWireMessage): Promise<void>;
    /**
     * Synchronize the peer using the peer's synchronization mechanism.
     * @param peer
     */
    private _syncPeer;
    private _restoreState;
    private _validateUtxos;
}
