diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index bd64a0cbf..c2516d712 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -720,11 +720,14 @@ proc start*(node: Eth2Node) {.async.} = traceAsyncErrors node.discoveryLoop proc stop*(node: Eth2Node) {.async.} = - # ignore errors in futures, since we're shutting down - await allFutures(@[ - node.discovery.closeWait(), - node.switch.stop(), - ]) + # Ignore errors in futures, since we're shutting down. + # Use a timer to avoid hangups. + discard await one(sleepAsync(5.seconds), + allFutures(@[ + node.discovery.closeWait(), + node.switch.stop(), + ]) + ) proc init*(T: type Peer, network: Eth2Node, info: PeerInfo): Peer = new result