Fix regression from #80 on validator_keygen (#86)

This commit is contained in:
Mamy Ratsimbazafy 2019-02-06 20:58:18 +01:00 committed by GitHub
parent 337aa83f1a
commit 224f22d377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -102,3 +102,4 @@ proc writeValue*(writer: var JsonWriter, value: ValidatorPrivKey) {.inline.} =
proc readValue*(reader: var JsonReader, value: var ValidatorPrivKey) {.inline.} =
value = SigKey.init(reader.readValue(string))
proc newPrivKey*(): ValidatorPrivKey = SigKey.random()

View File

@ -12,12 +12,13 @@ proc genSingleValidator(path: string): (ValidatorPubKey,
ValidatorPrivKey,
Eth2Digest) =
var v: PrivateValidatorData
# v.privKey = newSigKey()
v.privKey = newPrivKey()
if randomBytes(v.randao.seed.data) != sizeof(v.randao.seed.data):
raise newException(Exception, "Could not generate randao seed")
writeFile(path, v)
assert v.privKey != ValidatorPrivKey(), "Private key shouldn't be zero"
return (v.privKey.pubKey(), v.privKey, v.randao.initialCommitment)
# TODO: Make these more comprehensive and find them a new home