amadeus_node/consensus/
mod.rs1#![allow(clippy::module_inception)]
2pub mod consensus;
3pub mod doms;
4pub mod fabric;
5pub mod genesis;
6
7pub use amadeus_utils::constants::{
9 DST, DST_ANR, DST_ANR_CHALLENGE, DST_ATT, DST_ENTRY, DST_MOTION, DST_NODE, DST_POP, DST_TX, DST_VRF,
10};
11
12use crate::utils::misc::TermExt;
13use crate::utils::rocksdb::RocksDb;
14use amadeus_utils::constants::CF_SYSCONF;
15use eetf::Term;
16
17pub fn chain_epoch(db: &RocksDb) -> u32 {
20 chain_height(db) / 100_000
21}
22
23pub fn chain_height(db: &RocksDb) -> u32 {
25 match db.get(CF_SYSCONF, b"temporal_height") {
26 Ok(Some(bytes)) => {
27 match Term::decode(&bytes[..]) {
29 Ok(term) => TermExt::get_integer(&term).unwrap_or(0) as u32,
30 Err(_) => 0, }
32 }
33 _ => 0, }
35}