ProtocolId can now be more than 3 bytes (#2350)

This commit is contained in:
Pierre Krieger
2019-04-23 18:15:21 +02:00
committed by Gavin Wood
parent 517746bd62
commit b483c5608f
4 changed files with 26 additions and 18 deletions
+1 -7
View File
@@ -186,13 +186,7 @@ impl<Components: components::Components> Service<Components> {
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());
}
let id_len = protocol_id_full.len().min(protocol_id.len());
&mut protocol_id[0..id_len].copy_from_slice(&protocol_id_full[0..id_len]);
protocol_id
network::ProtocolId::from(protocol_id_full)
};
let has_bootnodes = !network_params.network_config.boot_nodes.is_empty();