implement is_proposer(...)

This commit is contained in:
Dustin Brody 2020-02-20 23:32:09 +01:00 committed by tersec
parent 4782ae06e6
commit bced5ca656
1 changed files with 7 additions and 0 deletions

View File

@ -217,3 +217,10 @@ func get_committee_assignment(
if validator_index in committee:
return some((committee, index, slot))
none(tuple[a: seq[ValidatorIndex], b: uint64, c: Slot])
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/validator.md#validator-assignments
func is_proposer(
state: BeaconState, validator_index: ValidatorIndex): bool =
var cache = get_empty_per_epoch_cache()
let proposer_index = get_beacon_proposer_index(state, cache)
proposer_index.isSome and proposer_index.get == validator_index