diff --git a/beacon_chain/eth1_monitor.nim b/beacon_chain/eth1_monitor.nim index 414c854cc..e432c5924 100644 --- a/beacon_chain/eth1_monitor.nim +++ b/beacon_chain/eth1_monitor.nim @@ -404,7 +404,7 @@ proc init*(T: type Eth1Monitor, let web3Fut = newWeb3(web3Url) yield web3Fut or sleepAsync(chronos.seconds(5)) if (not web3Fut.finished) or web3Fut.failed: - web3Fut.cancel() + await cancelAndWait(web3Fut) return err "Failed to setup web3 connection" let diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index f54204ba4..3137c9871 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -789,13 +789,10 @@ proc dialPeer*(node: Eth2Node, peerAddr: PeerAddr, index = 0) {.async.} = deadline.cancel() inc nbc_successful_dials else: - # TODO(cheatfate): As soon as `nim-libp2p` will be able to handle cancellation - # properly and will have cancellation tests, we need add here cancellation - # of `workfut`. - # workfut.cancel() debug "Connection to remote peer timed out" inc nbc_timeout_dials node.addSeen(peerAddr.peerId, SeenTableTimeTimeout) + await cancelAndWait(workfut) except CatchableError as exc: debug "Connection to remote peer failed", msg = exc.msg inc nbc_failed_dials diff --git a/vendor/nim-chronos b/vendor/nim-chronos index 710454cc6..879c91724 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit 710454cc6b792748144882d7c97912b0c6cef138 +Subproject commit 879c917242ab2af0a8332669f92987cd1e40370f