File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,6 @@ pub fn obtain_private_key(
3535
3636 } else {
3737 if let Some ( ref path) = config. net_config_path {
38- fs:: create_dir_all ( Path :: new ( path) ) ?;
39-
4038 // Try fetch the key from a the file containing the secret.
4139 let secret_path = Path :: new ( path) . join ( SECRET_FILE ) ;
4240 match load_private_key_from_file ( & secret_path) {
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ use libp2p::kad::{KadConnectionType, KadQueryEvent};
2727use parking_lot:: Mutex ;
2828use rand;
2929use secret:: obtain_private_key;
30+ use std:: fs;
3031use std:: io:: { Error as IoError , ErrorKind as IoErrorKind } ;
3132use std:: iter;
3233use std:: net:: SocketAddr ;
@@ -52,6 +53,11 @@ pub fn start_service<TProtos>(
5253 registered_custom : TProtos ,
5354) -> Result < Service , Error >
5455where TProtos : IntoIterator < Item = RegisteredProtocol > {
56+
57+ if let Some ( ref path) = config. net_config_path {
58+ fs:: create_dir_all ( Path :: new ( path) ) ?;
59+ }
60+
5561 // Private and public keys configuration.
5662 let local_private_key = obtain_private_key ( & config) ?;
5763 let local_public_key = local_private_key. to_public_key ( ) ;
You can’t perform that action at this time.
0 commit comments