From 9e58e22761f49b9ec0771e47e1a1c9d17c9ec535 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 20 Feb 2020 10:09:30 +0200 Subject: [PATCH] [skip ci] remove an obsolete comment --- beacon_chain/libp2p_backend.nim | 4 ++++ beacon_chain/sync_protocol.nim | 9 --------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/beacon_chain/libp2p_backend.nim b/beacon_chain/libp2p_backend.nim index 18a54d7da..66fc9e1c2 100644 --- a/beacon_chain/libp2p_backend.nim +++ b/beacon_chain/libp2p_backend.nim @@ -188,10 +188,14 @@ proc dialPeer*(node: Eth2Node, peerInfo: PeerInfo) {.async.} = discard await node.switch.dial(peerInfo) var peer = node.getPeer(peerInfo) peer.wasDialed = true + debug "Initializing connection" await initializeConnection(peer) + + # TODO: This should happen automatically in the future in nim-libp2p debug "Subscribing to pubsub" await peer.network.switch.subscribeToPeer(peer.info) + inc libp2p_successful_dials debug "Network handshakes completed" diff --git a/beacon_chain/sync_protocol.nim b/beacon_chain/sync_protocol.nim index 48e5f1bf2..72ca79afc 100644 --- a/beacon_chain/sync_protocol.nim +++ b/beacon_chain/sync_protocol.nim @@ -156,15 +156,6 @@ proc handleInitialStatus(peer: Peer, state: BeaconSyncNetworkState, ourStatus: StatusMsg, theirStatus: StatusMsg) {.async, gcsafe.} = - when networkBackend == libp2p: - # TODO: This doesn't seem like an appropraite place for this call, - # but it's hard to pick a better place at the moment. - # nim-libp2p plans to add a general `onPeerConnected` callback which - # will allow us to implement the subscription earlier. - # The root of the problem is that both sides must call `subscribeToPeer` - # before any GossipSub traffic will flow between them. - discard - if theirStatus.forkVersion != state.forkVersion: notice "Irrelevant peer", peer, theirFork = theirStatus.forkVersion, ourFork = state.forkVersion