diff --git a/eth/p2p/kademlia.nim b/eth/p2p/kademlia.nim index a0e53a8..edbf0ef 100644 --- a/eth/p2p/kademlia.nim +++ b/eth/p2p/kademlia.nim @@ -46,7 +46,7 @@ type const BUCKET_SIZE = 16 BITS_PER_HOP = 8 - REQUEST_TIMEOUT = 900 # timeout of message round trips + REQUEST_TIMEOUT = chronos.milliseconds(900) # timeout of message round trips FIND_CONCURRENCY = 3 # parallel find node lookups ID_SIZE = 256 @@ -419,7 +419,7 @@ proc resolve*(k: KademliaProtocol, id: NodeId): Future[Node] {.async.} = proc bootstrap*(k: KademliaProtocol, bootstrapNodes: seq[Node], retries = 0) {.async.} = ## Bond with bootstrap nodes and do initial lookup. Retry `retries` times ## in case of failure, or indefinitely if `retries` is 0. - var retryInterval = 2 + var retryInterval = chronos.milliseconds(2) var numTries = 0 if bootstrapNodes.len != 0: while true: @@ -428,7 +428,7 @@ proc bootstrap*(k: KademliaProtocol, bootstrapNodes: seq[Node], retries = 0) {.a inc numTries if retries == 0 or numTries < retries: info "Failed to bond with bootstrap nodes, retrying" - retryInterval = min(10000, retryInterval * 2) + retryInterval = min(chronos.seconds(10), retryInterval * 2) await sleepAsync(retryInterval) else: info "Failed to bond with bootstrap nodes"