mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-12 09:26:51 +00:00
Dummy Weights
This commit is contained in:
parent
5c46edbe98
commit
2cf1573c52
1 changed files with 21 additions and 0 deletions
21
substrate/consensus/src/weights.rs
Normal file
21
substrate/consensus/src/weights.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// TODO
|
||||
|
||||
use tendermint_machine::ext::{BlockNumber, Round, Weights};
|
||||
|
||||
const VALIDATORS: usize = 1;
|
||||
|
||||
pub(crate) struct TendermintWeights;
|
||||
impl Weights for TendermintWeights {
|
||||
type ValidatorId = u16;
|
||||
|
||||
fn total_weight(&self) -> u64 {
|
||||
VALIDATORS.try_into().unwrap()
|
||||
}
|
||||
fn weight(&self, id: u16) -> u64 {
|
||||
[1; VALIDATORS][usize::try_from(id).unwrap()]
|
||||
}
|
||||
|
||||
fn proposer(&self, number: BlockNumber, round: Round) -> u16 {
|
||||
u16::try_from((number.0 + u64::from(round.0)) % u64::try_from(VALIDATORS).unwrap()).unwrap()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue