HomePhabricator

Get time less often in AddrManImpl::ResolveCollisions_()

Description

Get time less often in AddrManImpl::ResolveCollisions_()

Summary:
This makes the code less verbose. Also, future changes that change how
to get the time are less verbose.

Moreover, GetAdjustedTime() might arbitrarily change the value during
the execution of this function. For example, the system time advances
over a second boundary, or the network adjusts the time arbitrarily.
Most of the time however the value will not change, so it seems better
to always lock the value in this scope for clarity.

This is a backport of core#25224

Depends on D15089

Note that the work was already partially done in the initial backport adding this function (D1862, see review), and we get the time even less often by calling GetAdjustedTime outside of the for loop.

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15090

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Mar 28 2022, 15:29
PiRKCommitted on Jan 5 2024, 14:40
PiRKPushed on Jan 5 2024, 14:40
Reviewer
Restricted Project
Differential Revision
D15090: Get time less often in AddrManImpl::ResolveCollisions_()
Parents
rABC4030b963f17e: Remove redundant addrman time checks
Branches
Unknown
Tags
Unknown