Commit graph

2 commits

Author SHA1 Message Date
Dave Collins 6af9302374 More false positive prevention in new time tests.
This commit extends the same logic in the previous commit to the
comparison of offsets returned from the median time source in the tests.

In particular it modifies the tests to allow for the offsets to differ by
a second due to a boundary condition to prevent false positives.
2014-10-11 18:06:41 -05:00
Dave Collins df065eee19 Provide a new median time source API.
This commit provides a new interface, MedianTimeSource, along with a
concrete implementation which allows improved accuracy of time by making
use of the median network time as calculated from multiple time samples.

The time samples are to be provided by callers and are intended to come
from remote clients.

The calculations performed in this implementation exactly mirror those in
Bitcoin Core because time calculations are part of the consensus rules and
hence need to match exactly.
2014-10-10 01:12:39 -05:00