Ensure the listen addresses are consistent with the transport (#6436)

* Initial commit

Forked at: 82bdf1a891
No parent branch.

* Ensure the listen addresses are consistent with the transport

* Update client/network/src/error.rs

* Update client/network/src/service.rs

* Better implementation

* Fix bad previous impl

* add boot_nodes

* reserved nodes

* test boot nodes

* reserved nodes tests

* add public_addresses and make specific error type

* Update client/network/src/error.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Cecile Tonglet
2020-06-23 17:26:00 +02:00
committed by GitHub
parent bd79b3debc
commit 4bf044eac6
3 changed files with 187 additions and 1 deletions
+14 -1
View File
@@ -18,6 +18,7 @@
//! Substrate network possible errors.
use crate::config::TransportConfig;
use libp2p::{PeerId, Multiaddr};
use std::fmt;
@@ -48,7 +49,18 @@ pub enum Error {
second_id: PeerId,
},
/// Prometheus metrics error.
Prometheus(prometheus_endpoint::PrometheusError)
Prometheus(prometheus_endpoint::PrometheusError),
/// The network addresses are invalid because they don't match the transport.
#[display(
fmt = "The following addresses are invalid because they don't match the transport: {:?}",
addresses,
)]
AddressesForAnotherTransport {
/// Transport used.
transport: TransportConfig,
/// The invalid addresses.
addresses: Vec<Multiaddr>,
},
}
// Make `Debug` use the `Display` implementation.
@@ -65,6 +77,7 @@ impl std::error::Error for Error {
Error::Client(ref err) => Some(err),
Error::DuplicateBootnode { .. } => None,
Error::Prometheus(ref err) => Some(err),
Error::AddressesForAnotherTransport { .. } => None,
}
}
}