Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
doc: unwrap => expect, explain dropping the peerid
Browse files Browse the repository at this point in the history
  • Loading branch information
Joonas Koivunen committed Oct 6, 2020
1 parent 44100ef commit bcd81e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/p2p/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,17 @@ impl<Types: IpfsTypes> Behaviour<Types> {
let mut ret = Vec::new();

for addr in BOOTSTRAP_NODES {
let addr = addr.parse::<MultiaddrWithPeerId>().unwrap();
let addr = addr
.parse::<MultiaddrWithPeerId>()
.expect("see test bootstrap_nodes_are_multiaddr_with_peerid");
if self.swarm.bootstrappers.insert(addr.clone()) {
let MultiaddrWithPeerId {
multiaddr: ma,
peer_id,
} = addr;

// this is intentionally the multiaddr without peerid turned into plain multiaddr:
// libp2p cannot dial addresses which include peerids.
let ma: Multiaddr = ma.into();

self.kademlia.add_address(&peer_id, ma.clone());
Expand Down

0 comments on commit bcd81e2

Please sign in to comment.