mod.rs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /// Block definition
  2. pub mod block;
  3. pub use block::{Block, BlockInfo, BlockProposal, Header, ProposalChain};
  4. /// Consensus metadata
  5. pub mod metadata;
  6. pub use metadata::{LeadProof, Metadata};
  7. /// Consensus participant
  8. pub mod participant;
  9. pub use participant::{KeepAlive, Participant};
  10. /// Consensus state
  11. pub mod state;
  12. pub use state::{ValidatorState, ValidatorStatePtr};
  13. /// Utility functions and types
  14. use crate::util::time::Timestamp;
  15. /// P2P net protocols
  16. pub mod proto;
  17. /// async tasks to utilize the protocols
  18. pub mod task;
  19. /// Lamport clock
  20. pub mod clock;
  21. pub use clock::{Clock, Ticks};
  22. pub mod ouroboros;
  23. use lazy_static::lazy_static;
  24. lazy_static! {
  25. /// Genesis hash for the mainnet chain
  26. pub static ref MAINNET_GENESIS_HASH_BYTES: blake3::Hash = blake3::hash(b"darkfi_mainnet");
  27. /// Genesis timestamp for the mainnet chain
  28. pub static ref MAINNET_GENESIS_TIMESTAMP: Timestamp = Timestamp(1650887115);
  29. /// Genesis hash for the testnet chain
  30. pub static ref TESTNET_GENESIS_HASH_BYTES: blake3::Hash = blake3::hash(b"darkfi_testnet");
  31. /// Genesis timestamp for the testnet chain
  32. pub static ref TESTNET_GENESIS_TIMESTAMP: Timestamp = Timestamp(1650887115);
  33. /// Block version number
  34. pub static ref BLOCK_VERSION: u8 = 1;
  35. /// Block magic bytes
  36. pub static ref BLOCK_MAGIC_BYTES: [u8; 4] = [0x11, 0x6d, 0x75, 0x1f];
  37. /// Block info magic bytes
  38. pub static ref BLOCK_INFO_MAGIC_BYTES: [u8; 4] = [0x90, 0x44, 0xf1, 0xf6];
  39. }