Skip to content

Commit

Permalink
fix: make BlockStore::max_height work for a height of u32::MAX
Browse files Browse the repository at this point in the history
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
  • Loading branch information
ljedrz committed Jul 10, 2024
1 parent 71c3806 commit 79429b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ledger/store/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ impl<N: Network, B: BlockStorage<N>> BlockStore<N, B> {

/// Returns the height of the latest block in the storage.
pub fn max_height(&self) -> Option<u32> {
u32::try_from(self.storage.id_map().len_confirmed()).ok()?.checked_sub(1)
self.storage.id_map().len_confirmed().checked_sub(1)?.try_into().ok()
}

/// Returns an iterator over the block hashes, for all blocks in `self`.
Expand Down

0 comments on commit 79429b2

Please sign in to comment.