mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-02 19:21:37 +00:00
to/into consistency for PublicKey and PeerId (#2145)
- Change `PublicKey::into_protobuf_encoding` to `PublicKey::to_protobuf_encoding`. - Change `PublicKey::into_peer_id` to `PublicKey::to_peer_id`. - Change `PeerId::from_public_key(PublicKey)` to `PeerId::from_public_key(&PublicKey)`. - Add `From<&PublicKey> for PeerId`. Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -478,7 +478,7 @@ mod tests {
|
||||
let protocol = Identify::new(
|
||||
IdentifyConfig::new("a".to_string(), pubkey.clone())
|
||||
.with_agent_version("b".to_string()));
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id());
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id());
|
||||
(swarm, pubkey)
|
||||
};
|
||||
|
||||
@ -487,7 +487,7 @@ mod tests {
|
||||
let protocol = Identify::new(
|
||||
IdentifyConfig::new("c".to_string(), pubkey.clone())
|
||||
.with_agent_version("d".to_string()));
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id());
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id());
|
||||
(swarm, pubkey)
|
||||
};
|
||||
|
||||
@ -555,7 +555,7 @@ mod tests {
|
||||
IdentifyConfig::new("a".to_string(), pubkey.clone())
|
||||
// Delay identification requests so we can test the push protocol.
|
||||
.with_initial_delay(Duration::from_secs(u32::MAX as u64)));
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id());
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id());
|
||||
(swarm, pubkey)
|
||||
};
|
||||
|
||||
@ -566,7 +566,7 @@ mod tests {
|
||||
.with_agent_version("b".to_string())
|
||||
// Delay identification requests so we can test the push protocol.
|
||||
.with_initial_delay(Duration::from_secs(u32::MAX as u64)));
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id());
|
||||
let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id());
|
||||
(swarm, pubkey)
|
||||
};
|
||||
|
||||
@ -612,7 +612,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
swarm2.behaviour_mut().push(std::iter::once(pubkey1.clone().into_peer_id()));
|
||||
swarm2.behaviour_mut().push(std::iter::once(pubkey1.to_peer_id()));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ where
|
||||
.map(|addr| addr.to_vec())
|
||||
.collect();
|
||||
|
||||
let pubkey_bytes = info.public_key.into_protobuf_encoding();
|
||||
let pubkey_bytes = info.public_key.to_protobuf_encoding();
|
||||
|
||||
let message = structs_proto::Identify {
|
||||
agent_version: Some(info.agent_version),
|
||||
|
Reference in New Issue
Block a user