Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update core/src/peer_id.rs
Co-authored-by: Toralf Wittner <[email protected]>
  • Loading branch information
romanb and twittner authored Aug 25, 2020
commit ef70db93ce6b1847e25c0ec06b4e05f772a792d2
5 changes: 1 addition & 4 deletions core/src/peer_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ impl PeerId {
/// back the data as an error.
pub fn from_bytes(data: Vec<u8>) -> Result<PeerId, Vec<u8>> {
match Multihash::from_bytes(data) {
Ok(multihash) => match multihash.algorithm() {
Code::Sha2_256 | Code::Identity => Ok(PeerId { multihash }),
_ => Err(multihash.into_bytes())
},
Ok(multihash) => PeerId::from_multihash(multihash).map_err(Multihash::into_bytes),
Err(err) => Err(err.data),
}
}
Expand Down