mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 04:31:02 +00:00
BEEFY and GRANDPA protocol names should use full genesis hash (#10974)
std::fmt::Display shows formats as reduced hash (e.g. 0xb0a8…dafe) Use hex::encode to format full hash. Signed-off-by: acatangiu <adrian@parity.io>
This commit is contained in:
@@ -77,13 +77,13 @@ pub mod grandpa_protocol_name {
|
||||
/// Name of the notifications protocol used by GRANDPA.
|
||||
///
|
||||
/// Must be registered towards the networking in order for GRANDPA to properly function.
|
||||
pub fn standard_name<Hash: std::fmt::Display>(
|
||||
pub fn standard_name<Hash: AsRef<[u8]>>(
|
||||
genesis_hash: &Hash,
|
||||
chain_spec: &Box<dyn ChainSpec>,
|
||||
) -> std::borrow::Cow<'static, str> {
|
||||
let chain_prefix = match chain_spec.fork_id() {
|
||||
Some(fork_id) => format!("/{}/{}", genesis_hash, fork_id),
|
||||
None => format!("/{}", genesis_hash),
|
||||
Some(fork_id) => format!("/{}/{}", hex::encode(genesis_hash), fork_id),
|
||||
None => format!("/{}", hex::encode(genesis_hash)),
|
||||
};
|
||||
format!("{}{}", chain_prefix, NAME).into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user