diff --git a/eth/p2p/p2p_backends_helpers.nim b/eth/p2p/p2p_backends_helpers.nim index a4d5f2f..640b718 100644 --- a/eth/p2p/p2p_backends_helpers.nim +++ b/eth/p2p/p2p_backends_helpers.nim @@ -61,6 +61,6 @@ proc verifyStateType(t: NimNode): NimNode = if result.kind != nnkBracketExpr or $result[0] != "ref": macros.error($result & " must be a ref type") -proc newFuture[T](location: var Future[T]) = - location = newFuture[T]() +proc initFuture[T](loc: var Future[T]) = + loc = newFuture[T]() diff --git a/eth/p2p/rlpx.nim b/eth/p2p/rlpx.nim index da80edd..feebf75 100644 --- a/eth/p2p/rlpx.nim +++ b/eth/p2p/rlpx.nim @@ -500,7 +500,7 @@ proc nextMsg*(peer: Peer, MsgType: type): Future[MsgType] = if not f.isNil: return Future[MsgType](f) - newFuture result + initFuture result peer.awaitedMessages[wantedId] = result # Known fatal errors are handled inside dispatchMessages. @@ -776,12 +776,12 @@ macro p2pProtocolImpl(name: static[string], responseMsgId) if hasReqIds: appendParams.add quote do: - newFuture `resultIdent` + initFuture `resultIdent` let `reqId` = `registerRequestCall` paramsToWrite.add reqId else: appendParams.add quote do: - newFuture `resultIdent` + initFuture `resultIdent` discard `registerRequestCall` of rlpxResponse: