mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-10 21:19:24 +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:
@@ -214,8 +214,8 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||||||
let round_end = self.block.end_time[&end_round];
|
let round_end = self.block.end_time[&end_round];
|
||||||
sleep(round_end.instant().saturating_duration_since(Instant::now())).await;
|
sleep(round_end.instant().saturating_duration_since(Instant::now())).await;
|
||||||
|
|
||||||
// Only keep queued messages for this block
|
// Clear our outbound message queue
|
||||||
self.queue = self.queue.drain(..).filter(|msg| msg.number == self.block.number).collect();
|
self.queue = VecDeque::new();
|
||||||
|
|
||||||
// Create the new block
|
// Create the new block
|
||||||
self.block = BlockData {
|
self.block = BlockData {
|
||||||
@@ -339,6 +339,7 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||||||
|
|
||||||
if let Some((broadcast, msg)) = futures::select_biased! {
|
if let Some((broadcast, msg)) = futures::select_biased! {
|
||||||
// Handle a new height occuring externally (an external sync loop)
|
// 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() => {
|
msg = self.step_recv.next() => {
|
||||||
if let Some((commit, proposal)) = msg {
|
if let Some((commit, proposal)) = msg {
|
||||||
self.reset_by_commit(commit, proposal).await;
|
self.reset_by_commit(commit, proposal).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user