From 2023a953ff0a1d19a04771ed6d875baf10c9e8d3 Mon Sep 17 00:00:00 2001 From: Andrei Eres Date: Mon, 2 Sep 2024 13:44:08 +0200 Subject: [PATCH] Send OurViewChange with priority instead of using an unbounded channel --- polkadot/node/network/bridge/src/rx/mod.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/polkadot/node/network/bridge/src/rx/mod.rs b/polkadot/node/network/bridge/src/rx/mod.rs index 7745c42f78a1..81425da3122f 100644 --- a/polkadot/node/network/bridge/src/rx/mod.rs +++ b/polkadot/node/network/bridge/src/rx/mod.rs @@ -826,7 +826,8 @@ where finalized_number, &metrics, ¬ification_sinks, - ); + ) + .await; note_peers_count(&metrics, &shared); } } @@ -919,7 +920,7 @@ fn construct_view( } #[overseer::contextbounds(NetworkBridgeRx, prefix = self::overseer)] -fn update_our_view( +async fn update_our_view( ctx: &mut Context, live_heads: &[ActivatedLeaf], shared: &Shared, @@ -967,10 +968,12 @@ fn update_our_view( finalized_number, ); - dispatch_validation_event_to_all_unbounded( + dispatch_validation_event_to_all( NetworkBridgeEvent::OurViewChange(our_view.clone()), ctx.sender(), - ); + &metrics, + ) + .await; dispatch_collation_event_to_all_unbounded( NetworkBridgeEvent::OurViewChange(our_view), @@ -1140,12 +1143,10 @@ async fn dispatch_validation_events_to_all( if let Ok(event) = $event.focus() { let has_high_priority = matches!( event, - // NetworkBridgeEvent::OurViewChange(..) must also be here, - // but it is sent via an unbounded channel. - // See https://github.com/paritytech/polkadot-sdk/issues/824 NetworkBridgeEvent::PeerConnected(..) | NetworkBridgeEvent::PeerDisconnected(..) | - NetworkBridgeEvent::PeerViewChange(..) + NetworkBridgeEvent::PeerViewChange(..) | + NetworkBridgeEvent::OurViewChange(..) ); let message = $message::from(event); if has_high_priority {