HomePhabricator

Remove GetAdjustedTime from init.cpp

Description

Remove GetAdjustedTime from init.cpp

Summary:

It seems confusing to call GetAdjustedTime there, because no offset could have been retrieved from the network at this point. Even if connman was started, timedata needs at least 5 peer connections to calculate an offset.

Fix the confusion by replacing GetAdjustedTime with GetTime, which does not change behavior.

Also:

    Replace magic number with MAX_FUTURE_BLOCK_TIME to clarify the context
    Add test, which passes both on current master and this pull request
    An unrelated refactoring commit, happy to drop

Backport of core#23636.

Depends on D12548 and D12552.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Nov 30 2021, 13:49
FabienCommitted on Nov 21 2022, 19:26
FabienPushed on Nov 21 2022, 19:26
Reviewer
Restricted Project
Differential Revision
D12554: Remove GetAdjustedTime from init.cpp
Parents
rABC8a4c9ccfe3f0: test: improve rpc_blockchain.py tests and assert on time and mediantime
Branches
Unknown
Tags
Unknown