One more attempt to fix compilation error.

This commit is contained in:
cheatfate 2020-02-26 16:46:21 +02:00 committed by zah
parent 278b91d6ce
commit ab1a08084b
2 changed files with 14 additions and 14 deletions

View File

@ -75,7 +75,7 @@ when networkBackend in [libp2p, libp2pDaemon]:
when networkBackend == libp2p: when networkBackend == libp2p:
import import
libp2p/standard_setup, libp2p_backend, peer_pool, peerinfo libp2p/standard_setup, libp2p_backend, libp2p/peerinfo, peer_pool
export export
libp2p_backend, peer_pool, peerinfo libp2p_backend, peer_pool, peerinfo

View File

@ -31,7 +31,7 @@ proc fetchAncestorBlocksFromPeer(
responseHandler(b) responseHandler(b)
except CatchableError as err: except CatchableError as err:
debug "Error while fetching ancestor blocks", debug "Error while fetching ancestor blocks",
err = err.msg, root = rec.root, peer err = err.msg, root = rec.root, peer = peer
when networkBackend == libp2p: when networkBackend == libp2p:
@ -48,7 +48,7 @@ when networkBackend == libp2p:
responseHandler(b) responseHandler(b)
except CatchableError as err: except CatchableError as err:
debug "Error while fetching ancestor blocks", debug "Error while fetching ancestor blocks",
err = err.msg, root = rec.root, peer = peer.info err = err.msg, root = rec.root, peer = peer
finally: finally:
if not(isNil(peer)): if not(isNil(peer)):
network.peerPool.release(peer) network.peerPool.release(peer)
@ -74,15 +74,15 @@ elif networkBackend == libp2pDaemon:
proc fetchAncestorBlocks*(requestManager: RequestManager, proc fetchAncestorBlocks*(requestManager: RequestManager,
roots: seq[FetchRecord], roots: seq[FetchRecord],
responseHandler: FetchAncestorsResponseHandler) = responseHandler: FetchAncestorsResponseHandler) =
# TODO: we could have some fancier logic here: # TODO: we could have some fancier logic here:
# #
# * Keeps track of what was requested # * Keeps track of what was requested
# (this would give a little bit of time for the asked peer to respond) # (this would give a little bit of time for the asked peer to respond)
# #
# * Keep track of the average latency of each peer # * Keep track of the average latency of each peer
# (we can give priority to peers with better latency) # (we can give priority to peers with better latency)
# #
const ParallelRequests = 2 const ParallelRequests = 2
for peer in requestManager.network.randomPeers(ParallelRequests, BeaconSync): for peer in requestManager.network.randomPeers(ParallelRequests, BeaconSync):
traceAsyncErrors peer.fetchAncestorBlocksFromPeer(roots.sample(), responseHandler) traceAsyncErrors peer.fetchAncestorBlocksFromPeer(roots.sample(), responseHandler)