Merge remote-tracking branch 'origin/release-v7.0.0' into unstable

This commit is contained in:
Michael Sproul
2025-03-29 13:01:58 +11:00
21 changed files with 364 additions and 48 deletions

View File

@@ -1475,6 +1475,21 @@ impl<E: EthSpec> Network<E> {
}
}
/// Adds the given `enr` to the trusted peers mapping and tries to dial it
/// every heartbeat to maintain the connection.
pub fn dial_trusted_peer(&mut self, enr: Enr) {
self.peer_manager_mut().add_trusted_peer(enr.clone());
self.peer_manager_mut().dial_peer(enr);
}
/// Remove the given peer from the trusted peers mapping if it exists and disconnect
/// from it.
pub fn remove_trusted_peer(&mut self, enr: Enr) {
self.peer_manager_mut().remove_trusted_peer(enr.clone());
self.peer_manager_mut()
.disconnect_peer(enr.peer_id(), GoodbyeReason::TooManyPeers);
}
/* Sub-behaviour event handling functions */
/// Handle a gossipsub event.