mirror of https://github.com/status-im/nim-eth.git
Remove unused lastUpdated from buckets (#382)
This commit is contained in:
parent
04ff8e460f
commit
dd02d1be23
|
@ -46,7 +46,6 @@ type
|
||||||
replacementCache: seq[Node] ## Nodes that could not be added to the `nodes`
|
replacementCache: seq[Node] ## Nodes that could not be added to the `nodes`
|
||||||
## seq as it is full and without stale nodes. This is practically a small
|
## seq as it is full and without stale nodes. This is practically a small
|
||||||
## LRU cache.
|
## LRU cache.
|
||||||
lastUpdated: float ## epochTime of last update to `nodes` in the KBucket.
|
|
||||||
ipLimits: IpLimits ## IP limits for bucket: node entries and replacement
|
ipLimits: IpLimits ## IP limits for bucket: node entries and replacement
|
||||||
## cache entries combined.
|
## cache entries combined.
|
||||||
|
|
||||||
|
@ -470,7 +469,6 @@ proc setJustSeen*(r: RoutingTable, n: Node) =
|
||||||
if idx >= 0:
|
if idx >= 0:
|
||||||
if idx != 0:
|
if idx != 0:
|
||||||
b.nodes.moveRight(0, idx - 1)
|
b.nodes.moveRight(0, idx - 1)
|
||||||
b.lastUpdated = epochTime()
|
|
||||||
|
|
||||||
if not n.seen:
|
if not n.seen:
|
||||||
b.nodes[0].seen = true
|
b.nodes[0].seen = true
|
||||||
|
@ -481,9 +479,8 @@ proc nodeToRevalidate*(r: RoutingTable): Node =
|
||||||
## bucket is selected.
|
## bucket is selected.
|
||||||
var buckets = r.buckets
|
var buckets = r.buckets
|
||||||
r.rng[].shuffle(buckets)
|
r.rng[].shuffle(buckets)
|
||||||
# TODO: Should we prioritize less-recently-updated buckets instead? Could use
|
# TODO: Should we prioritize less-recently-updated buckets instead? Could
|
||||||
# `lastUpdated` for this, but it would probably make more sense to only update
|
# store a `now` Moment at setJustSeen or at revalidate per bucket.
|
||||||
# that value on revalidation then and rename it to `lastValidated`.
|
|
||||||
for b in buckets:
|
for b in buckets:
|
||||||
if b.len > 0:
|
if b.len > 0:
|
||||||
return b.nodes[^1]
|
return b.nodes[^1]
|
||||||
|
|
Loading…
Reference in New Issue