Represents a pool of peers that handles all p2p network activity. This tracks all active and pending peers, optionally runs a server to listen for incoming connections, and is the primary interface for other modules to interact with the p2p layer.
An array of IP addresses or host names which can be used to connect to this server. It will be advertised with peers for them to try to connect to the server in the future.
Whether or not to automatically detect and share current external ip address on startup.
Whether to send a GetNodes packet to discover new nodes upon connecting to peers, defaults to true.
Time interval between sending GetNodes packets to already connected peers. Measured in minutes, only applies if discover option is true.
Whether or not to listen for incoming connections from peers.
Which port to listen on. If 0, a random unused port will be used.
Whether to allow connections to tor nodes.
The port that Tor's exposed SOCKS5 proxy is listening on.
Points to config comes during construction.
The port on which to listen for peer connections, undefined if this node is not listening.
The minimum version of xud we accept for peers
Our node pub key.
The local handshake data to be sent to newly connected peers.
A collection of known nodes on the XU network.
A collection of opened, active peers.
A set of peers for which we have pending incoming connections.
A map of pub keys to nodes for which we have pending outgoing connections.
The version of xud we are using.
This symbol shall be used to install a listener for only monitoring
events. Listeners installed using this symbol are called before the regular
'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error' event is emitted, therefore the process will still crash if no
'error' listener is installed.
Attempt to add an outbound peer by connecting to a given socket address and nodePubKey. Throws an error if a socket connection to or the handshake with the node fails for any reason.
the socket address of the node to connect to
the nodePubKey of the node to connect to
a promise that resolves to the connected and opened peer
Broadcasts an OrderInvalidationPacket to all currently connected peers.
the node pub key of a node to exclude from the packet broadcast
Iterate over a collection of nodes and attempt to connect to them. If the node is banned, already connected, or has no listening addresses, then do nothing. Additionally, if we're already trying to connect to a given node also do nothing.
a collection of nodes with a
forEach iterator to attempt to connect to
whether to allow connecting to nodes we are already aware of, defaults to true
whether to attempt retry connecting, defaults to false
a promise that will resolve when all outbound connections resolve
Notifies listeners that a peer's advertised but inactive pairs should be verified.
Notifies listeners that a previously active pair was dropped by the peer or deactivated.
Gets the active XU network as specified by the configuration.
the active XU network
Gets a node's reputation score and whether it is banned
The node pub key of the node for which to get reputation information
true if the specified node exists and the event was added, false otherwise
Initialize the Pool by connecting to known nodes and listening to incoming peer connections, if configured to do so.
Starts listening for incoming p2p connections on the configured host and port. If
this.listenPort is 0 or undefined,
a random available port is used and will be assigned to
a promise that resolves once the server is listening, or rejects if it fails to listen
Adds a listener to be called when a peer's advertised but inactive pairs should be verified.
Adds a listener to be called when a previously active pair is dropped by the peer or deactivated.
Opens a connection to a peer and performs a routine for newly opened peers that includes requesting open orders and updating the database with the peer's information.
a promise that resolves once the connection has opened and the newly opened peer routine is complete
Resolves an alias to a known node's public key. Throws an error if a unique pub key cannot be found for the provided alias.
Attempt to create an outbound connection to a node using its known listening addresses.
Stops listening for incoming p2p connections.
a promise that resolves once the server is no longer listening
Updates our connext public key and supported token addresses, then sends a node state update packet to currently connected peers to notify them of the change.
Updates our lnd pub key and chain identifier for a given currency and sends a node state update packet to currently connected peers to notify them of the change.
Updates our active trading pairs and sends a node state update packet to currently connected peers to notify them of the change.
Validates a peer. If a check fails, closes the peer and throws a p2p error.
Generated using TypeDoc