mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-24 11:36:18 +00:00
Correct Substrate Tendermint start block
The Tendermint machine uses the passed in number as the block's being worked on number. Substrate passed in the already finalized block's number. Also updates misc comments.
This commit is contained in:
parent
9a54317743
commit
8d3efd6259
3 changed files with 6 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::{
|
||||
convert::TryInto,
|
||||
pin::Pin,
|
||||
sync::{Arc, RwLock},
|
||||
task::{Poll, Context},
|
||||
|
@ -115,8 +116,8 @@ where
|
|||
0,
|
||||
(
|
||||
// Header::Number: TryInto<u64> doesn't implement Debug and can't be unwrapped
|
||||
match best.try_into() {
|
||||
Ok(best) => BlockNumber(best),
|
||||
match TryInto::<u64>::try_into(best) {
|
||||
Ok(best) => BlockNumber(best + 1),
|
||||
Err(_) => panic!("BlockNumber exceeded u64"),
|
||||
},
|
||||
Commit::<TendermintValidators<B, Be, C>>::decode(
|
||||
|
|
|
@ -25,7 +25,7 @@ struct TendermintValidatorsStruct {
|
|||
weights: Vec<u64>,
|
||||
|
||||
keys: Pair, // TODO: sp_keystore
|
||||
lookup: Vec<Public>, // TODO: sessions
|
||||
lookup: Vec<Public>,
|
||||
}
|
||||
|
||||
impl TendermintValidatorsStruct {
|
||||
|
|
|
@ -157,7 +157,7 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||
fn timeout(&self, step: Step) -> Instant {
|
||||
let mut round_time = Duration::from_secs(N::BLOCK_TIME.into());
|
||||
round_time *= self.round.0 + 1;
|
||||
let step_time = round_time / 3;
|
||||
let step_time = round_time / 3; // TODO: Non-uniform timeouts
|
||||
|
||||
let offset = match step {
|
||||
Step::Propose => step_time,
|
||||
|
|
Loading…
Reference in a new issue