Update bootnodes and boot_node cli (#1961)

This commit is contained in:
Age Manning 2020-11-25 02:01:37 +11:00 committed by GitHub
parent 11c4968ea0
commit a96893744c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -120,7 +120,10 @@ pub fn build_or_load_enr<T: EthSpec>(
Ok(local_enr) Ok(local_enr)
} }
pub fn create_enr_builder_from_config<T: EnrKey>(config: &NetworkConfig) -> EnrBuilder<T> { pub fn create_enr_builder_from_config<T: EnrKey>(
config: &NetworkConfig,
enable_tcp: bool,
) -> EnrBuilder<T> {
let mut builder = EnrBuilder::new("v4"); let mut builder = EnrBuilder::new("v4");
if let Some(enr_address) = config.enr_address { if let Some(enr_address) = config.enr_address {
builder.ip(enr_address); builder.ip(enr_address);
@ -129,8 +132,10 @@ pub fn create_enr_builder_from_config<T: EnrKey>(config: &NetworkConfig) -> EnrB
builder.udp(udp_port); builder.udp(udp_port);
} }
// we always give it our listening tcp port // we always give it our listening tcp port
if enable_tcp {
let tcp_port = config.enr_tcp_port.unwrap_or_else(|| config.libp2p_port); let tcp_port = config.enr_tcp_port.unwrap_or_else(|| config.libp2p_port);
builder.tcp(tcp_port).tcp(config.libp2p_port); builder.tcp(tcp_port);
}
builder builder
} }
@ -140,7 +145,7 @@ pub fn build_enr<T: EthSpec>(
config: &NetworkConfig, config: &NetworkConfig,
enr_fork_id: EnrForkId, enr_fork_id: EnrForkId,
) -> Result<Enr, String> { ) -> Result<Enr, String> {
let mut builder = create_enr_builder_from_config(config); let mut builder = create_enr_builder_from_config(config, true);
// set the `eth2` field on our ENR // set the `eth2` field on our ENR
builder.add_value(ETH2_ENR_KEY, &enr_fork_id.as_ssz_bytes()); builder.add_value(ETH2_ENR_KEY, &enr_fork_id.as_ssz_bytes());

View File

@ -79,7 +79,7 @@ impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
let private_key = load_private_key(&network_config, &logger); let private_key = load_private_key(&network_config, &logger);
let local_key = CombinedKey::from_libp2p(&private_key)?; let local_key = CombinedKey::from_libp2p(&private_key)?;
let mut local_enr = create_enr_builder_from_config(&network_config) let mut local_enr = create_enr_builder_from_config(&network_config, false)
.build(&local_key) .build(&local_key)
.map_err(|e| format!("Failed to build ENR: {:?}", e))?; .map_err(|e| format!("Failed to build ENR: {:?}", e))?;

View File

@ -1,6 +1,6 @@
# Lighthouse Team (Sigma Prime) # Lighthouse Team (Sigma Prime)
- enr:-Iu4QA1Cki3nwtymCmsx3KWt20ZdKrmljLl_5gfItvL5w6idfl7Nr5ysHQyNS7CxO5bbbB997nYDlb_47pZ3CAOvbxoBgmlkgnY0gmlwhAMaHiCJc2VjcDI1NmsxoQJIdpj_foZ02MXz4It8xKD7yUHTBx7lVFn3oeRP21KRV4N0Y3CCIyiDdWRwgiMo - enr:-IS4QLkKqDMy_ExrpOEWa59NiClemOnor-krjp4qoeZwIw2QduPC-q7Kz4u1IOWf3DDbdxqQIgC4fejavBOuUPy-HE4BgmlkgnY0gmlwhCLzAHqJc2VjcDI1NmsxoQLQSJfEAHZApkm5edTCZ_4qps_1k_ub2CxHFxi-gr2JMIN1ZHCCIyg
- enr:-Iu4QFEg1KXis_wX0vRwBcv_vGzbcifwLE_rFqqQRMxT3c0kAMVtbbAW2U7LcPIIKmzPfpVFRG0M4C457dmkKgzYEpkBgmlkgnY0gmlwhCLzAHqJc2VjcDI1NmsxoQLQSJfEAHZApkm5edTCZ_4qps_1k_ub2CxHFxi-gr2JMIN0Y3CCIyiDdWRwgiMo - enr:-IS4QDAyibHCzYZmIYZCjXwU9BqpotWmv2BsFlIq1V31BwDDMJPFEbox1ijT5c2Ou3kvieOKejxuaCqIcjxBjJ_3j_cBgmlkgnY0gmlwhAMaHiCJc2VjcDI1NmsxoQJIdpj_foZ02MXz4It8xKD7yUHTBx7lVFn3oeRP21KRV4N1ZHCCIyg
# Teku team (Consensys) # Teku team (Consensys)
- enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA - enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA
# Prysm team (Prysmatic Labs) # Prysm team (Prysmatic Labs)