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:
Ruben De Smet
2021-07-22 22:34:13 +02:00
committed by GitHub
parent 20183c1ea1
commit 371a7dab2c
63 changed files with 228 additions and 110 deletions

View File

@ -228,7 +228,7 @@ impl GossipsubCodec {
};
// The key must match the peer_id
if source != public_key.clone().into_peer_id() {
if source != public_key.to_peer_id() {
warn!("Signature verification failed: Public key doesn't match source peer id");
return false;
}