Flip order of `assert` and assignment

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
This commit is contained in:
Etan Kissling 2022-07-15 12:03:09 +02:00
parent dbefbcf326
commit 6146f01400
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
1 changed files with 2 additions and 2 deletions

View File

@ -319,8 +319,8 @@ def validate_light_client_update(store: LightClientStore,
assert update.finalized_header == BeaconBlockHeader()
else:
if update.finalized_header.slot == GENESIS_SLOT:
finalized_root = Bytes32()
assert update.finalized_header == BeaconBlockHeader()
finalized_root = Bytes32()
else:
finalized_root = hash_tree_root(update.finalized_header)
assert is_valid_merkle_branch(
@ -508,8 +508,8 @@ def create_light_client_update(state: BeaconState,
)
assert hash_tree_root(finalized_header) == attested_state.finalized_checkpoint.root
else:
finalized_header = BeaconBlockHeader()
assert attested_state.finalized_checkpoint.root == Bytes32()
finalized_header = BeaconBlockHeader()
finality_branch = compute_merkle_proof_for_state(attested_state, FINALIZED_ROOT_INDEX)
else:
finalized_header = BeaconBlockHeader()