Page MenuHomePhabricator

Get time less often in AddrManImpl::ResolveCollisions_()
ClosedPublic

Authored by PiRK on Jan 5 2024, 12:15.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCb329fbbf9ab6: 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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable