mirror of
https://github.com/serai-dex/serai.git
synced 2025-04-10 00:07:33 +00:00
Move BlockData to a new file
This commit is contained in:
parent
2f3bb88744
commit
b7b57ee6dc
2 changed files with 28 additions and 17 deletions
23
substrate/tendermint/machine/src/block.rs
Normal file
23
substrate/tendermint/machine/src/block.rs
Normal file
|
@ -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<N: Network> {
|
||||
pub(crate) number: BlockNumber,
|
||||
pub(crate) validator_id: Option<N::ValidatorId>,
|
||||
pub(crate) proposal: N::Block,
|
||||
|
||||
pub(crate) log: MessageLog<N>,
|
||||
pub(crate) slashes: HashSet<N::ValidatorId>,
|
||||
pub(crate) end_time: HashMap<RoundNumber, CanonicalInstant>,
|
||||
|
||||
pub(crate) round: RoundData<N>,
|
||||
|
||||
pub(crate) locked: Option<(RoundNumber, <N::Block as Block>::Id)>,
|
||||
pub(crate) valid: Option<(RoundNumber, N::Block)>,
|
||||
}
|
|
@ -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<V: ValidatorId> {
|
|||
Temporal,
|
||||
}
|
||||
|
||||
struct BlockData<N: Network> {
|
||||
number: BlockNumber,
|
||||
validator_id: Option<N::ValidatorId>,
|
||||
proposal: N::Block,
|
||||
|
||||
log: MessageLog<N>,
|
||||
slashes: HashSet<N::ValidatorId>,
|
||||
end_time: HashMap<RoundNumber, CanonicalInstant>,
|
||||
|
||||
round: RoundData<N>,
|
||||
|
||||
locked: Option<(RoundNumber, <N::Block as Block>::Id)>,
|
||||
valid: Option<(RoundNumber, N::Block)>,
|
||||
}
|
||||
|
||||
/// A machine executing the Tendermint protocol.
|
||||
pub struct TendermintMachine<N: Network> {
|
||||
network: N,
|
||||
|
|
Loading…
Reference in a new issue