Update `get_children` def
This commit is contained in:
parent
f27905583f
commit
21cecba6bb
|
@ -752,7 +752,7 @@ The beacon chain fork choice rule is a hybrid that combines justification and fi
|
|||
* Let `get_ancestor(store: Store, block: BeaconBlock, slot: SlotNumber) -> BeaconBlock` be the ancestor of `block` with slot number `slot`. The `get_ancestor` function can be defined recursively as `def get_ancestor(store: Store, block: BeaconBlock, slot: SlotNumber) -> BeaconBlock: return block if block.slot == slot else get_ancestor(store, store.get_parent(block), slot)`.
|
||||
* Let `get_latest_attestation(store: Store, validator: Validator) -> Attestation` be the attestation with the highest slot number in `store` from `validator`. If several such attestations exist, use the one the [validator](#dfn-validator) `v` observed first.
|
||||
* Let `get_latest_attestation_target(store: Store, validator: Validator) -> BeaconBlock` be the target block in the attestation `get_latest_attestation(store, validator)`.
|
||||
* Let `get_children(block: BeaconBlock) -> List[BeaconBlock]` returns the children blocks of the given `block`.
|
||||
* Let `get_children(store: Store, block: BeaconBlock) -> List[BeaconBlock]` returns the children blocks of the given `block`.
|
||||
* Let `justified_head_state` be the `BeaconState` object after processing `justified_head`.
|
||||
* The `head` is `lmd_ghost(store, justified_head_state, justified_head)` where the function `lmd_ghost` is defined below. Note that the implementation below is suboptimal; there are implementations that compute the head in time logarithmic in slot count.
|
||||
|
||||
|
@ -777,7 +777,7 @@ def lmd_ghost(store: Store, start_state: BeaconState, start_block: BeaconBlock)
|
|||
|
||||
head = start_block
|
||||
while 1:
|
||||
children = get_children(head)
|
||||
children = get_children(store, head)
|
||||
if len(children) == 0:
|
||||
return head
|
||||
head = max(children, key=get_vote_count)
|
||||
|
|
Loading…
Reference in New Issue