You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
828 B
37 lines
828 B
use serde::{Deserialize, Serialize};
|
|
use std::ops::Add;
|
|
|
|
/// Represent a block height, or block number, expressed in absolute block
|
|
/// count. E.g. The transaction was included in block #655123, 655123 block
|
|
/// after the genesis block.
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize)]
|
|
#[serde(transparent)]
|
|
pub struct BlockHeight(u32);
|
|
|
|
impl From<BlockHeight> for u32 {
|
|
fn from(height: BlockHeight) -> Self {
|
|
height.0
|
|
}
|
|
}
|
|
|
|
impl BlockHeight {
|
|
pub const fn new(block_height: u32) -> Self {
|
|
Self(block_height)
|
|
}
|
|
}
|
|
|
|
impl Add<u32> for BlockHeight {
|
|
type Output = BlockHeight;
|
|
|
|
fn add(self, rhs: u32) -> Self::Output {
|
|
BlockHeight(self.0 + rhs)
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub enum ExpiredTimelocks {
|
|
None,
|
|
Cancel,
|
|
Punish,
|
|
}
|