use super::BlockHeader;
use scsys::{Id, Timestamp};
impl BlockHeader {
pub const fn new(id: Id, timestamp: Timestamp) -> Self {
Self { id, timestamp }
}
pub fn from_id(id: Id) -> Self {
Self {
id,
timestamp: Timestamp::now(),
}
}
pub const fn id(&self) -> Id {
self.id
}
pub const fn timestamp(&self) -> Timestamp {
self.timestamp
}
}
impl Default for BlockHeader {
fn default() -> Self {
Self {
id: Id::atomic(),
timestamp: Timestamp::now(),
}
}
}