HomePhabricator

Retain only the most recent time samples
1c4aab926e0bUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Retain only the most recent time samples

Remembering all time samples makes nTimeOffset slow to respond to
system clock corrections. For instance, I start my node with a system
clock that's 30 minutes slow and run it for a few days. During that
time, I accumulate 10,000 offset samples with a median of 1800
seconds. Now I correct my system clock. Without this change, my node
must collect another 10,000 samples before nTimeOffset is correct
again. With this change, I must only accumulate 100 samples to
correct the offset.

Storing unlimited time samples also allows an attacker with many IP
addresses (ex, a large botnet) to perform a memory exhaustion attack
against Bitcoin nodes. The attacker sends a version message from each
IP to his target, consuming more of the target's memory each time.
Time samples are small, so this attack might be impractical under the
old code, but it's impossible with the new code.

Details

Provenance
Michael Hendricks <michael@ndrix.org>Authored on Nov 30 2011, 03:15
schancelPushed on Jan 5 2018, 21:58
schancelPushed on Jan 5 2018, 21:39
schancelPushed on Jan 5 2018, 21:17
Parents
rSTAGING5e1ddc421060: Only log time samples in debug mode
Branches
Unknown
Tags
Unknown

Event Timeline

Michael Hendricks <michael@ndrix.org> committed rSTAGING1c4aab926e0b: Retain only the most recent time samples (authored by Michael Hendricks <michael@ndrix.org>).Dec 2 2011, 00:28