mirror of
https://github.com/serai-dex/serai.git
synced 2025-04-02 12:29:03 +00:00
Clear the Queue instead of draining and filtering
There shouldn't ever be a message which passes the filter under the current design.
This commit is contained in:
parent
850878330e
commit
2de4ab8c9d
1 changed files with 3 additions and 2 deletions
|
@ -214,8 +214,8 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||
let round_end = self.block.end_time[&end_round];
|
||||
sleep(round_end.instant().saturating_duration_since(Instant::now())).await;
|
||||
|
||||
// Only keep queued messages for this block
|
||||
self.queue = self.queue.drain(..).filter(|msg| msg.number == self.block.number).collect();
|
||||
// Clear our outbound message queue
|
||||
self.queue = VecDeque::new();
|
||||
|
||||
// Create the new block
|
||||
self.block = BlockData {
|
||||
|
@ -339,6 +339,7 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||
|
||||
if let Some((broadcast, msg)) = futures::select_biased! {
|
||||
// Handle a new height occuring externally (an external sync loop)
|
||||
// Has the highest priority as it makes all other futures here irrelevant
|
||||
msg = self.step_recv.next() => {
|
||||
if let Some((commit, proposal)) = msg {
|
||||
self.reset_by_commit(commit, proposal).await;
|
||||
|
|
Loading…
Reference in a new issue