Fix `validator not in registry` and `$` bugs.

This commit is contained in:
cheatfate 2019-02-07 12:51:21 +02:00
parent 2d71b998c7
commit 20e7ca48b5
2 changed files with 2 additions and 6 deletions

View File

@ -123,10 +123,6 @@ template findIt(s: openarray, predicate: untyped): int =
break
res
template isSameKey(lhs, rhs: ValidatorPubKey): bool =
# TODO: operator `==` for ValidatorPubKey doesn't work properly at the moment
$lhs == $rhs
proc addLocalValidators*(node: BeaconNode) =
for validator in node.config.validators:
let
@ -134,7 +130,7 @@ proc addLocalValidators*(node: BeaconNode) =
pubKey = privKey.pubKey()
randao = validator.randao
let idx = node.beaconState.validator_registry.findIt(isSameKey(it.pubKey, pubKey))
let idx = node.beaconState.validator_registry.findIt(it.pubKey == pubKey)
if idx == -1:
warn "Validator not in registry", pubKey
else:

View File

@ -51,7 +51,7 @@ import
export
json_serialization
export blscurve.init, blscurve.getBytes, blscurve.combine
export blscurve.init, blscurve.getBytes, blscurve.combine, blscurve.`$`, blscurve.`==`
type
ValidatorPubKey* = blscurve.VerKey