@node-lightning/wire
Version:
Lightning Network Wire Protocol
51 lines (50 loc) • 1.6 kB
TypeScript
import { ILogger } from "@node-lightning/logger";
import { ChannelAnnouncementMessage } from "../messages/ChannelAnnouncementMessage";
import { ChannelUpdateMessage } from "../messages/ChannelUpdateMessage";
import { NodeAnnouncementMessage } from "../messages/NodeAnnouncementMessage";
export declare enum GossipSyncWatcherState {
Idle = 0,
Watching = 1,
Complete = 2,
Canceled = 3
}
/**
* GossipSyncWatcher monitors the progress of a GossipSync operation for the
* completion of the synchronization and signals once the sync has completed
* or timed out.
*/
export declare class GossipSyncWatcher {
readonly logger: ILogger;
completeAfterMs: number;
private _state;
private _timeoutHandle;
private _messageCounter;
private _resolve;
private _reject;
constructor(logger: ILogger);
/**
* Gets the state of the Watcher: IDLE, WATCHING, COMPLETE, FAILED
*/
get state(): GossipSyncWatcherState;
/**
* Gets the number of messages that have been seen while watching
*/
get messageCounter(): number;
/**
* Watches gossip traffic until a completion event occurs or watching is
* cancelled.
*/
watch(): Promise<void>;
/**
* Process a message and debounce when it is a gossip message
* @param msg
*/
onGossipMessage(msg: ChannelAnnouncementMessage | ChannelUpdateMessage | NodeAnnouncementMessage): void;
/**
* Cancels watching and sends a failure signal.
*/
cancel(): void;
private _clearTimeout;
private _setTimeout;
private _onTimeout;
}