Add warning when using default protocol ID (#2234)

* Add warning when using default protocol ID

* Update core/service/src/lib.rs
This commit is contained in:
Pierre Krieger
2019-04-09 05:30:43 -03:00
committed by Bastian Köcher
parent cb766e5f5d
commit e57e54ab9c
+9 -1
View File
@@ -154,7 +154,15 @@ impl<Components: components::Components> Service<Components> {
};
let protocol_id = {
let protocol_id_full = config.chain_spec.protocol_id().unwrap_or(DEFAULT_PROTOCOL_ID).as_bytes();
let protocol_id_full = match config.chain_spec.protocol_id() {
Some(pid) => pid,
None => {
warn!("Using default protocol ID {:?} because none is configured in the \
chain specs", DEFAULT_PROTOCOL_ID
);
DEFAULT_PROTOCOL_ID
}
}.as_bytes();
let mut protocol_id = network::ProtocolId::default();
if protocol_id_full.len() > protocol_id.len() {
warn!("Protocol ID truncated to {} chars", protocol_id.len());