handle missing validators dir during key import

This commit is contained in:
Zahary Karadjov 2019-03-19 23:04:22 +02:00
parent 23b7cbfc9c
commit b454501595
1 changed files with 3 additions and 2 deletions

View File

@ -72,8 +72,9 @@ proc obtainTestnetKey(conf: BeaconNodeConf): Future[ValidatorPrivKey] {.async.}
return ValidatorPrivKey.init(privKeyContent)
proc saveValidatorKey(key: ValidatorPrivKey, conf: BeaconNodeConf) =
let filename = conf.dataDir / dataDirValidators / $key.pubKey
writeFile(filename, $key)
let validatorsDir = conf.dataDir / dataDirValidators
createDir validatorsDir
writeFile(validatorsDir / $key.pubKey, $key)
proc init*(T: type BeaconNode, conf: BeaconNodeConf): Future[BeaconNode] {.async.} =
new result