mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 13:39:25 +00:00
Move BlockData to a new file
This commit is contained in:
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;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
mod time;
|
mod time;
|
||||||
use time::*;
|
use time::{sys_time, CanonicalInstant};
|
||||||
|
|
||||||
mod round;
|
mod round;
|
||||||
use round::*;
|
use round::RoundData;
|
||||||
|
|
||||||
|
mod block;
|
||||||
|
use block::BlockData;
|
||||||
|
|
||||||
mod message_log;
|
mod message_log;
|
||||||
use message_log::MessageLog;
|
use message_log::MessageLog;
|
||||||
@@ -106,21 +109,6 @@ enum TendermintError<V: ValidatorId> {
|
|||||||
Temporal,
|
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.
|
/// A machine executing the Tendermint protocol.
|
||||||
pub struct TendermintMachine<N: Network> {
|
pub struct TendermintMachine<N: Network> {
|
||||||
network: N,
|
network: N,
|
||||||
|
|||||||
Reference in New Issue
Block a user