mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-19 19:09:08 +00:00
parent
3ff9b69bf1
commit
10dbd773c7
@ -44,16 +44,9 @@ proc validateBeaconApiQueries*(key: string, value: string): int =
|
||||
else:
|
||||
1
|
||||
|
||||
proc validateFilter(filters: seq[ValidatorFilter]): Result[ValidatorFilter,
|
||||
cstring] =
|
||||
var res: ValidatorFilter
|
||||
for item in filters:
|
||||
if res * item != {}:
|
||||
return err("Validator status must be unique")
|
||||
res.incl(item)
|
||||
|
||||
if res == {}:
|
||||
res = {ValidatorFilterKind.PendingInitialized,
|
||||
const
|
||||
AllValidatorFilterKinds = {
|
||||
ValidatorFilterKind.PendingInitialized,
|
||||
ValidatorFilterKind.PendingQueued,
|
||||
ValidatorFilterKind.ActiveOngoing,
|
||||
ValidatorFilterKind.ActiveExiting,
|
||||
@ -61,7 +54,18 @@ proc validateFilter(filters: seq[ValidatorFilter]): Result[ValidatorFilter,
|
||||
ValidatorFilterKind.ExitedUnslashed,
|
||||
ValidatorFilterKind.ExitedSlashed,
|
||||
ValidatorFilterKind.WithdrawalPossible,
|
||||
ValidatorFilterKind.WithdrawalDone}
|
||||
ValidatorFilterKind.WithdrawalDone
|
||||
}
|
||||
|
||||
proc validateFilter(filters: seq[ValidatorFilter]): Result[ValidatorFilter,
|
||||
cstring] =
|
||||
var res: ValidatorFilter
|
||||
for item in filters:
|
||||
if res * item != {}:
|
||||
return err("Validator status must be unique")
|
||||
res.incl(item)
|
||||
if res == {}:
|
||||
return ok(AllValidatorFilterKinds)
|
||||
ok(res)
|
||||
|
||||
proc getStatus(validator: Validator,
|
||||
@ -413,7 +417,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||
Http400, InvalidRequestBodyError, $error)
|
||||
let
|
||||
ids = request.ids.valueOr: @[]
|
||||
filter = request.status.valueOr: {}
|
||||
filter = request.status.valueOr: AllValidatorFilterKinds
|
||||
(ids, filter)
|
||||
sid = state_id.valueOr:
|
||||
return RestApiResponse.jsonError(Http400, InvalidStateIdValueError,
|
||||
|
Loading…
x
Reference in New Issue
Block a user