diff --git a/substrate/tendermint/machine/src/block.rs b/substrate/tendermint/machine/src/block.rs new file mode 100644 index 00000000..9c100ccc --- /dev/null +++ b/substrate/tendermint/machine/src/block.rs @@ -0,0 +1,23 @@ +use std::collections::{HashSet, HashMap}; + +use crate::{ + time::CanonicalInstant, + ext::{RoundNumber, BlockNumber, Block, Network}, + round::RoundData, + message_log::MessageLog, +}; + +pub(crate) struct BlockData { + pub(crate) number: BlockNumber, + pub(crate) validator_id: Option, + pub(crate) proposal: N::Block, + + pub(crate) log: MessageLog, + pub(crate) slashes: HashSet, + pub(crate) end_time: HashMap, + + pub(crate) round: RoundData, + + pub(crate) locked: Option<(RoundNumber, ::Id)>, + pub(crate) valid: Option<(RoundNumber, N::Block)>, +} diff --git a/substrate/tendermint/machine/src/lib.rs b/substrate/tendermint/machine/src/lib.rs index 0a28c0ee..ab996724 100644 --- a/substrate/tendermint/machine/src/lib.rs +++ b/substrate/tendermint/machine/src/lib.rs @@ -16,10 +16,13 @@ use futures::{ use tokio::time::sleep; mod time; -use time::*; +use time::{sys_time, CanonicalInstant}; mod round; -use round::*; +use round::RoundData; + +mod block; +use block::BlockData; mod message_log; use message_log::MessageLog; @@ -106,21 +109,6 @@ enum TendermintError { Temporal, } -struct BlockData { - number: BlockNumber, - validator_id: Option, - proposal: N::Block, - - log: MessageLog, - slashes: HashSet, - end_time: HashMap, - - round: RoundData, - - locked: Option<(RoundNumber, ::Id)>, - valid: Option<(RoundNumber, N::Block)>, -} - /// A machine executing the Tendermint protocol. pub struct TendermintMachine { network: N,