"init" should handle fake/invalid pubkeys and signatures
This commit is contained in:
parent
3c140d0c3d
commit
14bc9e60ca
|
@ -332,11 +332,14 @@ template fromSszBytes*(T: type BlsValue, bytes: openarray[byte]): auto =
|
|||
# ----------------------------------------------------------------------
|
||||
|
||||
# For confutils
|
||||
func init*(T: typedesc[ValidatorPrivKey], hex: string): T {.inline.} =
|
||||
func init*(T: typedesc[ValidatorPrivKey], hex: string): T {.noInit, 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
|
||||
func init*(T: typedesc[ValidatorPubKey], data: array[48, byte]): T {.noInit, inline.} =
|
||||
result.initFromBytes(data)
|
||||
|
||||
# For mainchain monitor
|
||||
func init*(T: typedesc[ValidatorSig], data: array[96, byte]): T {.noInit, inline.} =
|
||||
result.initFromBytes(data)
|
||||
|
|
Loading…
Reference in New Issue