Skip to content

Commit

Permalink
fix: prefer configured seeds over dns seeds (#3662)
Browse files Browse the repository at this point in the history
Description
---

Prefer peer seeds in configuration file over DNS seed peers 

Motivation and Context
---
The user expects peers listed in their configuration to take preference

How Has This Been Tested?
---
  • Loading branch information
sdbondi authored Dec 19, 2021
1 parent 2c7988b commit 0f438aa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base_layer/p2p/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,8 @@ impl ServiceInitializer for P2pInitializer {

let (comms, dht) = configure_comms_and_dht(builder, &config, connector).await?;

let peers = Self::try_parse_seed_peers(&config.peer_seeds)?;
let peer_manager = comms.peer_manager();
let node_identity = comms.node_identity();
add_all_peers(&peer_manager, &node_identity, peers).await?;

let peers = match Self::try_resolve_dns_seeds(
config.dns_seeds_name_server,
Expand All @@ -580,6 +578,9 @@ impl ServiceInitializer for P2pInitializer {
};
add_all_peers(&peer_manager, &node_identity, peers).await?;

let peers = Self::try_parse_seed_peers(&config.peer_seeds)?;
add_all_peers(&peer_manager, &node_identity, peers).await?;

context.register_handle(comms.connectivity());
context.register_handle(peer_manager);
context.register_handle(comms);
Expand Down

0 comments on commit 0f438aa

Please sign in to comment.