diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2021-01-18 14:27:00 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2022-03-02 15:40:30 +0100 |
commit | 60da1eaa1113e7318e273144e7ef9c8895d7ed54 (patch) | |
tree | 6d9b7096cf9f87344fe14c27f87f008f0a94d21f /src/timedata.h | |
parent | 08bcfa27675da5c65e4c9eab7e7764eab0599298 (diff) |
timedata: make it possible to reset the state
Add a new function `TestOnlyResetTimeData()` which would reset the
internal state used by `GetTimeOffset()`, `GetAdjustedTime()` and
`AddTimeData()`.
This is needed so that unit tests that call `AddTimeData()` can restore
the state in order not to confuse other tests that rely on it.
Currently `timedata_tests/addtimedata` is the only test that modifies
the state (via `AddTimeData()`) and also the only test that relies on
that state.
Diffstat (limited to 'src/timedata.h')
-rw-r--r-- | src/timedata.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/timedata.h b/src/timedata.h index b165ecde26..2f039d5465 100644 --- a/src/timedata.h +++ b/src/timedata.h @@ -75,4 +75,9 @@ int64_t GetTimeOffset(); int64_t GetAdjustedTime(); void AddTimeData(const CNetAddr& ip, int64_t nTime); +/** + * Reset the internal state of GetTimeOffset(), GetAdjustedTime() and AddTimeData(). + */ +void TestOnlyResetTimeData(); + #endif // BITCOIN_TIMEDATA_H |