Add BlockHeight and BlockDelta hard types

Breaking change that adds a hard BlockHeight and BlockDelta type with the following properties:

  • BlockHeight wraps u32
  • BlockDelta wraps u16
  • both types have checked_ and saturating_ methods for explicit math
  • ops::Add for BlockHeiht + BlockDelta implements saturating_add
  • ops::Add for BlockDelta + BlockDelta implements saturating_add
  • BlockHeight has checked_sub(BlockHeight) -> Option<BlockDelta>
  • BlockHeight has checked_blocks_since(BlockHeight) -> Option<u32> which is often more practical

I recognize this is huge. Not in a hurry.

Edited by Steven Roose

Merge request reports

Loading
Loading