mirror of https://github.com/status-im/nim-eth.git
refactor: replace shallowCopy with something else
This commit is contained in:
parent
64b56d866c
commit
d238693571
|
@ -132,6 +132,7 @@ proc sendNeighbours*(d: DiscoveryProtocol, node: Node, neighbours: seq[Node]) =
|
|||
const MAX_NEIGHBOURS_PER_PACKET = 12 # TODO: Implement a smarter way to compute it
|
||||
type Neighbour = tuple[ip: IpAddress, udpPort, tcpPort: Port, pk: PublicKey]
|
||||
var nodes = newSeqOfCap[Neighbour](MAX_NEIGHBOURS_PER_PACKET)
|
||||
when not defined(nimSeqsV2):
|
||||
shallow(nodes)
|
||||
|
||||
template flush() =
|
||||
|
|
|
@ -482,10 +482,10 @@ proc len*(r: RoutingTable): int =
|
|||
proc moveRight[T](arr: var openArray[T], a, b: int) =
|
||||
## In `arr` move elements in range [a, b] right by 1.
|
||||
var t: T
|
||||
shallowCopy(t, arr[b + 1])
|
||||
t = system.move(arr[b + 1])
|
||||
for i in countdown(b, a):
|
||||
shallowCopy(arr[i + 1], arr[i])
|
||||
shallowCopy(arr[a], t)
|
||||
arr[i + 1] = system.move(arr[i])
|
||||
arr[a] = system.move(t)
|
||||
|
||||
proc setJustSeen*(r: RoutingTable, n: Node) =
|
||||
## Move `n` to the head (most recently seen) of its bucket.
|
||||
|
|
Loading…
Reference in New Issue