mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 23:57:56 +00:00
Change on-the-wire protocol names to include genesis hash & fork id (#11938)
* Rename transactions protocol to include genesis hash
* Add protocol name generation to sc_network::utils
* Use utils functions for transactions protocol name generation
* Extract protocol name generation into public module
* Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA
* minor: add missing newline at EOF
* Change block-announces protocol name to include genesis_hash & fork_id
* Change protocol names to include genesis hash and fork id
Protocols changed:
- sync
- state
- light
- sync/warp
* Revert "Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA"
This reverts commit cd60a95a3face397e1b67f4bc95dd0f2b581bfae.
* Get rid of `protocol_name` module
This commit is contained in:
@@ -276,6 +276,7 @@ where
|
||||
roles: Roles,
|
||||
chain: Arc<Client>,
|
||||
protocol_id: ProtocolId,
|
||||
fork_id: &Option<String>,
|
||||
network_config: &config::NetworkConfiguration,
|
||||
notifications_protocols_handshakes: Vec<Vec<u8>>,
|
||||
metrics_registry: Option<&Registry>,
|
||||
@@ -371,8 +372,17 @@ where
|
||||
sc_peerset::Peerset::from_config(sc_peerset::PeersetConfig { sets })
|
||||
};
|
||||
|
||||
let block_announces_protocol: Cow<'static, str> =
|
||||
format!("/{}/block-announces/1", protocol_id.as_ref()).into();
|
||||
let block_announces_protocol = {
|
||||
let genesis_hash =
|
||||
chain.block_hash(0u32.into()).ok().flatten().expect("Genesis block exists; qed");
|
||||
if let Some(fork_id) = fork_id {
|
||||
format!("/{}/{}/block-announces/1", hex::encode(genesis_hash), fork_id)
|
||||
} else {
|
||||
format!("/{}/block-announces/1", hex::encode(genesis_hash))
|
||||
}
|
||||
};
|
||||
|
||||
let legacy_ba_protocol_name = format!("/{}/block-announces/1", protocol_id.as_ref());
|
||||
|
||||
let behaviour = {
|
||||
let best_number = info.best_number;
|
||||
@@ -384,8 +394,8 @@ where
|
||||
.encode();
|
||||
|
||||
let sync_protocol_config = notifications::ProtocolConfig {
|
||||
name: block_announces_protocol,
|
||||
fallback_names: Vec::new(),
|
||||
name: block_announces_protocol.into(),
|
||||
fallback_names: iter::once(legacy_ba_protocol_name.into()).collect(),
|
||||
handshake: block_announces_handshake,
|
||||
max_notification_size: MAX_BLOCK_ANNOUNCE_SIZE,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user