Skip to content

Commit

Permalink
checkpoint: into main from release/2.3.0 @ 1ff7e09 (#17805)
Browse files Browse the repository at this point in the history
Source hash: 1ff7e09
Remaining commits: 1
  • Loading branch information
pmaslana committed Apr 2, 2024
2 parents 23288e7 + 00457c5 commit b684502
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions chia/full_node/block_height_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,24 @@ def rollback(self, fork_height: int) -> None:
# fork height may be -1, in which case all blocks are different and we
# should clear all sub epoch summaries
heights_to_delete = []
log.log(
logging.WARNING if fork_height < 100 else logging.INFO,
f"rolling back height-to-hash and sub-epoch-summaries cache to {fork_height}",
)

for ses_included_height in self.__sub_epoch_summaries.keys():
if ses_included_height > fork_height:
heights_to_delete.append(ses_included_height)

for height in heights_to_delete:
del self.__sub_epoch_summaries[height]

del self.__height_to_hash[(fork_height + 1) * 32 :]
self.__first_dirty = min(self.__first_dirty, fork_height + 1)

if len(heights_to_delete) > 0:
log.log(
logging.WARNING if fork_height < 100 else logging.INFO,
f"rolling back {len(heights_to_delete)} blocks in "
f"height-to-hash and sub-epoch-summaries cache, to height {fork_height}",
)

def get_ses(self, height: uint32) -> SubEpochSummary:
return SubEpochSummary.from_bytes(self.__sub_epoch_summaries[height])

Expand Down

0 comments on commit b684502

Please sign in to comment.