mirror of https://github.com/status-im/nim-eth.git
Fix ImplicitDefaultValue warnings + replace some obsolete inits (#697)
This commit is contained in:
parent
50e71b2daa
commit
3d66c5b899
|
@ -324,7 +324,8 @@ func update*(
|
|||
r: var Record,
|
||||
pk: PrivateKey,
|
||||
ip: Option[IpAddress],
|
||||
tcpPort, udpPort: Option[Port] = none[Port](),
|
||||
tcpPort: Option[Port] = none[Port](),
|
||||
udpPort: Option[Port] = none[Port](),
|
||||
extraFields: openArray[FieldPair] = []):
|
||||
EnrResult[void] =
|
||||
## Update a `Record` with given ip address, tcp port, udp port and optional
|
||||
|
|
|
@ -59,7 +59,8 @@ func newNode*(r: Record): Result[Node, cstring] =
|
|||
address: none(Address)))
|
||||
|
||||
func update*(n: Node, pk: PrivateKey, ip: Option[IpAddress],
|
||||
tcpPort, udpPort: Option[Port] = none[Port](),
|
||||
tcpPort: Option[Port] = none[Port](),
|
||||
udpPort: Option[Port] = none[Port](),
|
||||
extraFields: openArray[FieldPair] = []): Result[void, cstring] =
|
||||
? n.record.update(pk, ip, tcpPort, udpPort, extraFields)
|
||||
|
||||
|
|
|
@ -654,7 +654,7 @@ proc lookup*(d: Protocol, target: NodeId): Future[seq[Node]] {.async: (raises: [
|
|||
var closestNodes = d.routingTable.neighbours(target, BUCKET_SIZE,
|
||||
seenOnly = false)
|
||||
|
||||
var asked, seen = initHashSet[NodeId]()
|
||||
var asked, seen = HashSet[NodeId]()
|
||||
asked.incl(d.localNode.id) # No need to ask our own node
|
||||
seen.incl(d.localNode.id) # No need to discover our own node
|
||||
for node in closestNodes:
|
||||
|
@ -717,7 +717,7 @@ proc query*(d: Protocol, target: NodeId, k = BUCKET_SIZE): Future[seq[Node]]
|
|||
## the routing table, nodes returned by the first queries will be used.
|
||||
var queryBuffer = d.routingTable.neighbours(target, k, seenOnly = false)
|
||||
|
||||
var asked, seen = initHashSet[NodeId]()
|
||||
var asked, seen = HashSet[NodeId]()
|
||||
asked.incl(d.localNode.id) # No need to ask our own node
|
||||
seen.incl(d.localNode.id) # No need to discover our own node
|
||||
for node in queryBuffer:
|
||||
|
|
|
@ -533,7 +533,7 @@ proc randomNodes*(r: RoutingTable, maxAmount: int,
|
|||
maxAmount = sz
|
||||
|
||||
result = newSeqOfCap[Node](maxAmount)
|
||||
var seen = initHashSet[Node]()
|
||||
var seen = HashSet[Node]()
|
||||
|
||||
# This is a rather inefficient way of randomizing nodes from all buckets, but even if we
|
||||
# iterate over all nodes in the routing table, the time it takes would still be
|
||||
|
|
|
@ -121,7 +121,7 @@ proc new*[A](
|
|||
rng = newRng()): UtpRouter[A] =
|
||||
doAssert(not(isNil(acceptConnectionCb)))
|
||||
UtpRouter[A](
|
||||
sockets: initTable[UtpSocketKey[A], UtpSocket[A]](),
|
||||
sockets: Table[UtpSocketKey[A], UtpSocket[A]](),
|
||||
acceptConnection: acceptConnectionCb,
|
||||
allowConnection: allowConnectionCb,
|
||||
socketConfig: socketConfig,
|
||||
|
|
Loading…
Reference in New Issue