init for mainchain_monitor

This commit is contained in:
Mamy André-Ratsimbazafy 2020-03-04 23:13:37 +01:00 committed by tersec
parent 985298be1e
commit 31bd13a5d3
1 changed files with 8 additions and 0 deletions

View File

@ -328,7 +328,15 @@ proc readValue*(reader: var JsonReader, value: var Signature) {.inline.} =
template fromSszBytes*(T: type BlsValue, bytes: openarray[byte]): auto =
fromBytes(T, bytes)
# Initialization
# ----------------------------------------------------------------------
# For confutils
func init*(T: typedesc[ValidatorPrivKey], hex: string): T {.inline.} =
let success = result.fromHex(hex)
doAssert success, "Private key is invalid" # Don't display private keys even if invalid
# For mainchain monitor
func init*(T: typedesc[ValidatorPubKey], data: array[48, byte]): T {.inline.} =
let success = result.fromBytes(data)
doAssert success, "Public key is invalid" # Don't display private keys even if invalid