mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 11:52:42 +00:00
Merge branch 'deposit-flow' into kill-grpc
This commit is contained in:
@@ -62,6 +62,7 @@ pub struct ClientBuilder<T: BeaconChainTypes> {
|
||||
libp2p_network: Option<Arc<NetworkService<T>>>,
|
||||
libp2p_network_send: Option<UnboundedSender<NetworkMessage>>,
|
||||
http_listen_addr: Option<SocketAddr>,
|
||||
grpc_listen_addr: Option<(String, u16)>,
|
||||
websocket_listen_addr: Option<SocketAddr>,
|
||||
eth_spec_instance: T::EthSpec,
|
||||
}
|
||||
@@ -93,6 +94,7 @@ where
|
||||
libp2p_network: None,
|
||||
libp2p_network_send: None,
|
||||
http_listen_addr: None,
|
||||
grpc_listen_addr: None,
|
||||
websocket_listen_addr: None,
|
||||
eth_spec_instance,
|
||||
}
|
||||
@@ -425,6 +427,7 @@ where
|
||||
beacon_chain: self.beacon_chain,
|
||||
libp2p_network: self.libp2p_network,
|
||||
http_listen_addr: self.http_listen_addr,
|
||||
grpc_listen_addr: self.grpc_listen_addr,
|
||||
websocket_listen_addr: self.websocket_listen_addr,
|
||||
_exit_signals: self.exit_signals,
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ pub mod builder;
|
||||
pub mod error;
|
||||
|
||||
use beacon_chain::BeaconChain;
|
||||
use eth2_libp2p::{Enr, Multiaddr};
|
||||
use exit_future::Signal;
|
||||
use network::Service as NetworkService;
|
||||
use std::net::SocketAddr;
|
||||
@@ -24,6 +25,7 @@ pub struct Client<T: BeaconChainTypes> {
|
||||
libp2p_network: Option<Arc<NetworkService<T>>>,
|
||||
http_listen_addr: Option<SocketAddr>,
|
||||
websocket_listen_addr: Option<SocketAddr>,
|
||||
grpc_listen_addr: Option<(String, u16)>,
|
||||
/// Exit signals will "fire" when dropped, causing each service to exit gracefully.
|
||||
_exit_signals: Vec<Signal>,
|
||||
}
|
||||
@@ -39,6 +41,11 @@ impl<T: BeaconChainTypes> Client<T> {
|
||||
self.http_listen_addr
|
||||
}
|
||||
|
||||
/// Returns the address of the client's gRPC API server, if it was started.
|
||||
pub fn grpc_listen_addr(&self) -> Option<(String, u16)> {
|
||||
self.grpc_listen_addr.clone()
|
||||
}
|
||||
|
||||
/// Returns the address of the client's WebSocket API server, if it was started.
|
||||
pub fn websocket_listen_addr(&self) -> Option<SocketAddr> {
|
||||
self.websocket_listen_addr
|
||||
@@ -48,6 +55,16 @@ impl<T: BeaconChainTypes> Client<T> {
|
||||
pub fn libp2p_listen_port(&self) -> Option<u16> {
|
||||
self.libp2p_network.as_ref().map(|n| n.listen_port())
|
||||
}
|
||||
|
||||
/// Returns the list of libp2p addresses the client is listening to.
|
||||
pub fn libp2p_listen_addresses(&self) -> Option<Vec<Multiaddr>> {
|
||||
self.libp2p_network.as_ref().map(|n| n.listen_multiaddrs())
|
||||
}
|
||||
|
||||
/// Returns the local libp2p ENR of this node, for network discovery.
|
||||
pub fn enr(&self) -> Option<Enr> {
|
||||
self.libp2p_network.as_ref().map(|n| n.local_enr())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> Drop for Client<T> {
|
||||
|
||||
Reference in New Issue
Block a user