mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Complete merging of network addition branch
This commit is contained in:
@@ -111,14 +111,16 @@ impl<TSubstream: AsyncRead + AsyncWrite> NetworkBehaviourEventProcess<IdentifyEv
|
||||
);
|
||||
info.listen_addrs.truncate(20);
|
||||
}
|
||||
self.events
|
||||
.push(BehaviourEvent::Identified(peer_id, Box::new(info)));
|
||||
trace!(self.log, "Found addresses"; "Peer Id" => format!("{:?}", peer_id), "Addresses" => format!("{:?}", info.listen_addrs));
|
||||
// inject the found addresses into our discovery behaviour
|
||||
|
||||
for address in &info.listen_addrs {
|
||||
self.discovery
|
||||
.add_connected_address(&peer_id, address.clone());
|
||||
}
|
||||
|
||||
self.events
|
||||
.push(BehaviourEvent::Identified(peer_id, Box::new(info)));
|
||||
}
|
||||
IdentifyEvent::Error { .. } => {}
|
||||
IdentifyEvent::SendBack { .. } => {}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use clap::ArgMatches;
|
||||
use libp2p::gossipsub::{GossipsubConfig, GossipsubConfigBuilder};
|
||||
use libp2p::multiaddr::{Error as MultiaddrError, Multiaddr};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
use types::multiaddr::{Error as MultiaddrError, Multiaddr};
|
||||
|
||||
/// The beacon node topic string to subscribe to.
|
||||
pub const BEACON_PUBSUB_TOPIC: &str = "beacon_node";
|
||||
|
||||
@@ -55,7 +55,7 @@ impl<TSubstream> Discovery<TSubstream> {
|
||||
/// We have discovered an address for a peer, add it to known peers.
|
||||
pub fn add_connected_address(&mut self, peer_id: &PeerId, address: Multiaddr) {
|
||||
// pass the address on to kademlia
|
||||
self.discovery.add_connected_address(peer_id, address);
|
||||
self.discovery.add_address(peer_id, address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user