mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 05:52:45 +00:00
"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
|
# 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)
|
let success = result.fromHex(hex)
|
||||||
doAssert success, "Private key is invalid" # Don't display private keys even if invalid
|
doAssert success, "Private key is invalid" # Don't display private keys even if invalid
|
||||||
|
|
||||||
# For mainchain monitor
|
# For mainchain monitor
|
||||||
func init*(T: typedesc[ValidatorPubKey], data: array[48, byte]): T {.inline.} =
|
func init*(T: typedesc[ValidatorPubKey], data: array[48, byte]): T {.noInit, inline.} =
|
||||||
let success = result.fromBytes(data)
|
result.initFromBytes(data)
|
||||||
doAssert success, "Public key is invalid" # Don't display private keys even if invalid
|
|
||||||
|
# For mainchain monitor
|
||||||
|
func init*(T: typedesc[ValidatorSig], data: array[96, byte]): T {.noInit, inline.} =
|
||||||
|
result.initFromBytes(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user