Skip to content

Commit

Permalink
add assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
almogdepaz committed Dec 9, 2024
1 parent 465f56e commit e46b2bc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion chia/consensus/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,14 @@ def contains_block(self, header_hash: bytes32) -> bool:
True if we have already added this block to the chain. This may return false for orphan blocks
that we have added but no longer keep in memory.
"""
return header_hash in self.__block_records
# check block records
block_rec = self.__block_records[header_hash]
if block_rec is None:
return False
block_rec = self.height_to_block_record(block_rec.height)
assert block_rec is not None
assert block_rec.header_hash == header_hash
return True

def block_record(self, header_hash: bytes32) -> BlockRecord:
return self.__block_records[header_hash]
Expand Down

0 comments on commit e46b2bc

Please sign in to comment.