diff --git a/beacon_node/eth2-libp2p/src/service.rs b/beacon_node/eth2-libp2p/src/service.rs index b18a7dc51..18f7ca98c 100644 --- a/beacon_node/eth2-libp2p/src/service.rs +++ b/beacon_node/eth2-libp2p/src/service.rs @@ -57,7 +57,10 @@ impl Service { }; // listen on all addresses - for address in config.listen_addresses().expect("invalid listen multiaddr") { + for address in config + .listen_addresses() + .map_err(|e| format!("Invalid listen multiaddr: {}", e))? + { match Swarm::listen_on(&mut swarm, address.clone()) { Ok(mut listen_addr) => { listen_addr.append(Protocol::P2p(local_peer_id.clone().into())); @@ -68,7 +71,10 @@ impl Service { } // connect to boot nodes - these are currently stored as multiaddrs // Once we have discovery, can set to peerId - for bootnode in config.boot_nodes().expect("invalid boot node multiaddr") { + for bootnode in config + .boot_nodes() + .map_err(|e| format!("Invalid boot node multiaddr: {:?}", e))? + { match Swarm::dial_addr(&mut swarm, bootnode.clone()) { Ok(()) => debug!(log, "Dialing bootnode: {}", bootnode), Err(err) => debug!(