Remove DiscoveryNetBehaviour trait (#5430)

This commit is contained in:
Pierre Krieger
2020-04-01 17:25:53 +02:00
committed by GitHub
parent 72239adda1
commit 84ff6ef157
4 changed files with 20 additions and 29 deletions
+8 -7
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use crate::{DiscoveryNetBehaviour, config::ProtocolId};
use crate::config::ProtocolId;
use crate::utils::interval;
use bytes::{Bytes, BytesMut};
use futures::prelude::*;
@@ -1582,6 +1582,13 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
self.sync.request_finality_proof(&hash, number)
}
/// Notify the protocol that we have learned about the existence of nodes.
///
/// Can be called multiple times with the same `PeerId`s.
pub fn add_discovered_nodes(&mut self, peer_ids: impl Iterator<Item = PeerId>) {
self.behaviour.add_discovered_nodes(peer_ids)
}
pub fn finality_proof_import_result(
&mut self,
request_block: (B::Hash, NumberFor<B>),
@@ -2205,12 +2212,6 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviour for Protocol<B, H> {
}
}
impl<B: BlockT, H: ExHashT> DiscoveryNetBehaviour for Protocol<B, H> {
fn add_discovered_nodes(&mut self, peer_ids: impl Iterator<Item = PeerId>) {
self.behaviour.add_discovered_nodes(peer_ids)
}
}
impl<B: BlockT, H: ExHashT> Drop for Protocol<B, H> {
fn drop(&mut self) {
debug!(target: "sync", "Network stats:\n{}", self.format_stats());