units: Derive Default for BlockInterval

A block interval is a relative thing so it makes sense to default to
zero. This is the same as how we derive `Debug` for `relative::Height`
but not `absolute::Height`.
This commit is contained in:
Tobin C. Harding 2024-12-11 13:34:27 +11:00
parent aeca93b561
commit f5c2248a31
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ impl TryFrom<BlockHeight> for absolute::Height {
///
/// This type is not meant for constructing relative height based timelocks, this is a general
/// purpose block interval abstraction. For locktimes please see [`locktime::relative::Height`].
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
// Public to try and make it really clear that there are no invariants.
pub struct BlockInterval(pub u32);