HomePhabricator

p2p: Don't use timestamps from inbound peers

Description

p2p: Don't use timestamps from inbound peers

Summary:

This makes it harder for others to tamper with our adjusted time.

Rationale from the PR description:

With the extra feeler connections (every 2 minutes on average) and extra block-relay-only connections (every 5 minutes on average) there are also now plenty of opportunities to gather a meaningful number of timedata samples from outbound peers.

There are some measures in place to prevent abuse: the -maxtimeadjustment parameter with a default of 70 minutes, warnings in cases of large deviations, only using the first 200 samples (explanation), but I think that only using samples from outbound connections in the first place would be an additional safety measure that would make sense.

See also issue core#4521 for further context and links: There have been several discussions in the past about replacing or abolishing the existing timedata system.

The difference with the source material is caused by D6024. This changes previous behavior slightly: now the computed time offset is assigned to the node even if we are not going to use it to compute our adjusted time. This pfrom.nTimeOffset is only used for display purposes (RPC results, GUI).

This is a backport of core#23631

Depends on D13357

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
Martin Zumsande <mzumsande@gmail.com>Authored on Nov 29 2021, 15:33
PiRKCommitted on Mar 17 2023, 14:42
PiRKPushed on Mar 17 2023, 14:42
Reviewer
Restricted Project
Differential Revision
D13357: p2p: Don't use timestamps from inbound peers
Parents
rABC5041cbedc2b9: [test] improve style for abc-version-message.py and rename to…
Branches
Unknown
Tags
Unknown