Skip to content

Commit

Permalink
handle none
Browse files Browse the repository at this point in the history
  • Loading branch information
almogdepaz committed Dec 9, 2024
1 parent 74b27f4 commit b229e7e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion chia/_tests/util/blockchain_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def contains_block(self, header_hash: bytes32, height: Optional[uint32] = None)
return False
height = block_rec.height
block_hash_from_hh = self.height_to_hash(height)
assert block_hash_from_hh is not None
if block_hash_from_hh is None:
return False
assert block_hash_from_hh == header_hash
return True

Expand Down
3 changes: 2 additions & 1 deletion chia/consensus/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,8 @@ def contains_block(self, header_hash: bytes32, height: Optional[uint32] = None)
return False
height = block_rec.height
block_hash_from_hh = self.height_to_hash(height)
assert block_hash_from_hh is not None
if block_hash_from_hh is None:
return False
assert block_hash_from_hh == header_hash
return True

Expand Down
5 changes: 4 additions & 1 deletion chia/util/augmented_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ def contains_block(self, header_hash: bytes32, height: Optional[uint32] = None)
if block_rec is None:
return False
height = block_rec.height
if not self.contains_height(height):
return False
block_hash_from_hh = self.height_to_hash(height)
assert block_hash_from_hh is not None
if block_hash_from_hh is None:
return False
assert block_hash_from_hh == header_hash
return True

Expand Down
3 changes: 2 additions & 1 deletion chia/util/block_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def contains_block(self, header_hash: bytes32, height: Optional[uint32] = None)
return False
height = block_rec.height
block_hash_from_hh = self.height_to_hash(height)
assert block_hash_from_hh is not None
if block_hash_from_hh is None:
return False
assert block_hash_from_hh == header_hash
return True

Expand Down
3 changes: 2 additions & 1 deletion chia/wallet/wallet_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def contains_block(self, header_hash: bytes32, height: Optional[uint32] = None)
return False
height = block_rec.height
block_hash_from_hh = self.height_to_hash(height)
assert block_hash_from_hh is not None
if block_hash_from_hh is None:
return False
assert block_hash_from_hh == header_hash
return True

Expand Down

0 comments on commit b229e7e

Please sign in to comment.