mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Add NetworkBridgeEvent::UpdatedAuthorityIds (#6227)
* Add NetworkBridgeEvent::UpdatedAuthorityIds * update collator * informing subsystems * remove outdated authority data * docs * remove accidentally added line * update docs * emit event on session change * emit * check for update and update * Update node/network/gossip-support/src/lib.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/approval-distribution/src/lib.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/bitfield-distribution/src/lib.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/bridge/src/rx/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/collator-protocol/src/validator_side/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/collator-protocol/src/collator_side/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/bridge/src/rx/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update node/subsystem-types/src/messages.rs Co-authored-by: Andronik <write@reusable.software> * Update node/subsystem-types/src/messages.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/statement-distribution/src/lib.rs Co-authored-by: Andronik <write@reusable.software> * Update node/network/statement-distribution/src/lib.rs Co-authored-by: Andronik <write@reusable.software> * Update node/subsystem-types/src/messages/network_bridge_event.rs Co-authored-by: Andronik <write@reusable.software> * Update node/subsystem-types/src/messages.rs Co-authored-by: Andronik <write@reusable.software> * fixes * merge fixes * make clippy happy again * fix --------- Co-authored-by: Andronik <write@reusable.software>
This commit is contained in:
@@ -1754,6 +1754,34 @@ async fn handle_network_update<Context, R>(
|
||||
NetworkBridgeEvent::OurViewChange(_view) => {
|
||||
// handled by `ActiveLeavesUpdate`
|
||||
},
|
||||
NetworkBridgeEvent::UpdatedAuthorityIds(peer, authority_ids) => {
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?peer,
|
||||
?authority_ids,
|
||||
"Updated `AuthorityDiscoveryId`s"
|
||||
);
|
||||
|
||||
// get the outdated authority_ids stored for the specific peer_id.
|
||||
let old_auth_ids: Vec<AuthorityDiscoveryId> = authorities
|
||||
.into_iter()
|
||||
.filter(|(_, p)| **p == peer)
|
||||
.map(|(auth, _)| auth.clone())
|
||||
.collect();
|
||||
|
||||
// remove all of the outdated authority_ids.
|
||||
for auth in old_auth_ids {
|
||||
authorities.remove(&auth);
|
||||
}
|
||||
|
||||
// update `authorities` with the new updated data.
|
||||
authority_ids.clone().into_iter().for_each(|a| {
|
||||
authorities.insert(a, peer);
|
||||
});
|
||||
if let Some(data) = peers.get_mut(&peer) {
|
||||
data.maybe_authority = Some(authority_ids);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user