mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 03:58:04 +00:00
Pass an encoded Roles as the notifications protocols handshakes (#5665)
This commit is contained in:
@@ -1043,12 +1043,13 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
|
||||
&'a mut self,
|
||||
engine_id: ConsensusEngineId,
|
||||
protocol_name: impl Into<Cow<'static, [u8]>>,
|
||||
handshake_message: Vec<u8>,
|
||||
) -> impl ExactSizeIterator<Item = (&'a PeerId, Roles)> + 'a {
|
||||
let protocol_name = protocol_name.into();
|
||||
if self.protocol_name_by_engine.insert(engine_id, protocol_name.clone()).is_some() {
|
||||
error!(target: "sub-libp2p", "Notifications protocol already registered: {:?}", protocol_name);
|
||||
} else {
|
||||
self.behaviour.register_notif_protocol(protocol_name.clone(), Vec::new());
|
||||
self.behaviour.register_notif_protocol(protocol_name.clone(), handshake_message);
|
||||
self.legacy_equiv_by_name.insert(protocol_name, Fallback::Consensus(engine_id));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user