Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
timeoffsets.cpp
Go to the documentation of this file.
1// Copyright (c) 2024-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <node/timeoffsets.h>
6#include <node/warnings.h>
8#include <test/fuzz/fuzz.h>
10
11#include <chrono>
12#include <cstdint>
13#include <functional>
14
16{
17 static const auto testing_setup = MakeNoLogFileContext<>(ChainType::MAIN);
18}
19
21{
22 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
23 node::Warnings warnings{};
24 TimeOffsets offsets{warnings};
27 offsets.Add(std::chrono::seconds{fuzzed_data_provider.ConsumeIntegral<std::chrono::seconds::rep>()});
28 offsets.WarnIfOutOfSync();
29 }
30}
std::chrono::seconds Median() const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Compute and return the median of the collected time offset samples.
Manages warning messages within a node.
Definition warnings.h:40
#define FUZZ_TARGET(...)
Definition fuzz.h:35
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
Definition fuzz.h:22
static const int64_t offsets[]
void initialize_timeoffsets()
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:73
FuzzedDataProvider & fuzzed_data_provider
Definition fees.cpp:38