From 21cecba6bb24bdbb0e57cefab76c2b550527c89a Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 25 Jan 2019 16:06:05 +0800 Subject: [PATCH] Update `get_children` def --- specs/core/0_beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 382caeca7..a4440e924 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -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)