mirror of
https://github.com/serai-dex/serai.git
synced 2025-02-03 11:46:31 +00:00
Use a rounded genesis to obtain sufficient synchrony within the Docker env
This commit is contained in:
parent
38cee041d6
commit
ca043f55ad
1 changed files with 10 additions and 4 deletions
|
@ -78,6 +78,11 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
||||||
fn get_last(&self) -> (<T::Block as Block>::Hash, (BlockNumber, u64)) {
|
fn get_last(&self) -> (<T::Block as Block>::Hash, (BlockNumber, u64)) {
|
||||||
let info = self.import.client.info();
|
let info = self.import.client.info();
|
||||||
|
|
||||||
|
// TODO: Genesis start time + BLOCK_TIME
|
||||||
|
let mut fake_genesis = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();
|
||||||
|
// Round up to the nearest 5s increment
|
||||||
|
fake_genesis += 5 - (fake_genesis % 5);
|
||||||
|
|
||||||
(
|
(
|
||||||
info.finalized_hash,
|
info.finalized_hash,
|
||||||
(
|
(
|
||||||
|
@ -99,8 +104,7 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
)
|
)
|
||||||
.map(|commit| commit.end_time)
|
.map(|commit| commit.end_time)
|
||||||
// TODO: Genesis start time + BLOCK_TIME
|
.unwrap_or(fake_genesis),
|
||||||
.unwrap_or_else(|_| SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -189,9 +193,11 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle any received messages
|
// Handle any received messages
|
||||||
// This inner loop enables handling all pending messages before acquiring the out-queue lock
|
// This inner loop enables handling all pending messages before acquiring the out-queue lock
|
||||||
// again
|
// again
|
||||||
futures::poll!(&mut gossip);
|
// TODO: Move to a select model. The disadvantage of this is we'll more frequently acquire
|
||||||
|
// the above lock, despite lack of reason to do so
|
||||||
|
let _ = futures::poll!(&mut gossip);
|
||||||
'inner: loop {
|
'inner: loop {
|
||||||
match recv.try_next() {
|
match recv.try_next() {
|
||||||
Ok(Some(msg)) => handle
|
Ok(Some(msg)) => handle
|
||||||
|
|
Loading…
Reference in a new issue