mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 08:07:58 +00:00
Approval-distribution: Fix out-of-view messages caused by a race condition in view updates (#5089)
* Try to fix out-of-view messages in approval distribution Suggested by: @ordian * Cargo fmt * Add a unit test for the proposed fix * Spelling fix * Use a simplier approach to fix the race condition as suggested by @rphmeier * Cargo fmt run
This commit is contained in:
@@ -294,6 +294,20 @@ impl State {
|
||||
);
|
||||
|
||||
{
|
||||
for (peer_id, view) in self.peer_views.iter() {
|
||||
let intersection = view.iter().filter(|h| new_hashes.contains(h));
|
||||
let view_intersection = View::new(intersection.cloned(), view.finalized_number);
|
||||
Self::unify_with_peer(
|
||||
ctx,
|
||||
&self.gossip_peers,
|
||||
metrics,
|
||||
&mut self.blocks,
|
||||
peer_id.clone(),
|
||||
view_intersection,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
let pending_now_known = self
|
||||
.pending_known
|
||||
.keys()
|
||||
@@ -348,20 +362,6 @@ impl State {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (peer_id, view) in self.peer_views.iter() {
|
||||
let intersection = view.iter().filter(|h| new_hashes.contains(h));
|
||||
let view_intersection = View::new(intersection.cloned(), view.finalized_number);
|
||||
Self::unify_with_peer(
|
||||
ctx,
|
||||
&self.gossip_peers,
|
||||
metrics,
|
||||
&mut self.blocks,
|
||||
peer_id.clone(),
|
||||
view_intersection,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn process_incoming_peer_message(
|
||||
|
||||
Reference in New Issue
Block a user