disaronno 0.1.5

Disaronno is a blockchain framework designed to support the Scattered-Systems Ecosystem
Documentation
use serde::{Deserialize, Serialize};

use crate::types::{LocalTime, TimeStamp};

use super::types::*;

#[derive(Clone, Debug, Deserialize, Hash, Serialize)]
pub struct Block {
    pub id: BlockId,
    pub data: BlockData,
    pub hash: BlockHash,
    pub nonce: BlockNonce,
    pub previous: BlockHash,
    pub timestamp: TimeStamp,
}

impl Block {
    pub fn new(data: BlockData, nonce: BlockNonce, previous: BlockHash) -> Self {
        let id = BlockId::new();
        let timestamp: TimeStamp = LocalTime::now().into();
        Self {
            id,
            data,
            hash: String::from(""),
            nonce,
            previous,
            timestamp,
        }
    }
}