Apply suggestions from code review

This commit is contained in:
Danny Ryan 2021-11-11 07:29:38 -07:00 committed by GitHub
parent 6cfd38e800
commit 61207c5b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,7 @@ def get_pow_block_at_terminal_total_difficulty(pow_chain: Dict[Hash32, PowBlock]
# `pow_chain` abstractly represents all blocks in the PoW chain
for block in pow_chain:
block_reached_ttd = block.total_difficulty >= TERMINAL_TOTAL_DIFFICULTY
# If genesis block, no parent exists so reaching TTD alone qualifies as valid terminal block
if block_reached_ttd and block.parent_hash == Hash32():
return block
parent = pow_chain[block.parent_hash]