Fix to only allow sync for peer with eth support

This commit is contained in:
kdeme 2019-04-18 12:25:41 +02:00
parent 32bb1f35d7
commit 31290b6b35
1 changed files with 4 additions and 2 deletions

View File

@ -331,10 +331,12 @@ proc onPeerDisconnected(ctx: SyncContext, p: Peer) =
proc startSync(ctx: SyncContext) = proc startSync(ctx: SyncContext) =
var po: PeerObserver var po: PeerObserver
po.onPeerConnected = proc(p: Peer) {.gcsafe.} = po.onPeerConnected = proc(p: Peer) {.gcsafe.} =
ctx.onPeerConnected(p) if p.supports(eth):
ctx.onPeerConnected(p)
po.onPeerDisconnected = proc(p: Peer) {.gcsafe.} = po.onPeerDisconnected = proc(p: Peer) {.gcsafe.} =
ctx.onPeerDisconnected(p) if p.supports(eth):
ctx.onPeerDisconnected(p)
ctx.peerPool.addObserver(ctx, po) ctx.peerPool.addObserver(ctx, po)