#![cfg_attr(not(feature = "std"), no_std)]
use codec::Decode;
use sp_runtime::ConsensusEngineId;
use sp_std::vec::Vec;
pub const POW_ENGINE_ID: ConsensusEngineId = [b'p', b'o', b'w', b'_'];
pub type Seal = Vec<u8>;
pub trait TotalDifficulty {
fn increment(&mut self, other: Self);
}
impl TotalDifficulty for sp_core::U256 {
fn increment(&mut self, other: Self) {
let ret = self.saturating_add(other);
*self = ret;
}
}
impl TotalDifficulty for u128 {
fn increment(&mut self, other: Self) {
let ret = self.saturating_add(other);
*self = ret;
}
}
sp_api::decl_runtime_apis! {
pub trait TimestampApi<Moment: Decode> {
fn timestamp() -> Moment;
}
pub trait DifficultyApi<Difficulty: Decode> {
fn difficulty() -> Difficulty;
}
}