use case statement to avoid runtime doAssert
This commit is contained in:
parent
c142de4b7f
commit
9c65c50249
|
@ -108,11 +108,10 @@ func toPubKey*(privkey: ValidatorPrivKey): ValidatorPubKey =
|
|||
proc toRealPubKey(pubkey: ValidatorPubKey): Option[ValidatorPubKey] =
|
||||
var validatorKeyCache {.threadvar.}: Table[Hash, Option[ValidatorPubKey]]
|
||||
|
||||
if pubkey.kind == Real:
|
||||
case pubkey.kind:
|
||||
of Real:
|
||||
return some(pubkey)
|
||||
|
||||
doAssert pubkey.kind == OpaqueBlob
|
||||
|
||||
of OpaqueBlob:
|
||||
let key = hash(pubkey.blob)
|
||||
try:
|
||||
validatorKeyCache[key]
|
||||
|
|
Loading…
Reference in New Issue