8#include <chainparams.h>
51 }
catch (
const std::exception&) {
62 for (
size_t i = 0; i < 8 && !addr.
IsValid(); ++i) {
102 if (n > 0 && addrman.
Size() % n == 0) {
127 }
catch (
const std::ios_base::failure&) {
173 std::optional<Network> network;
182 std::unordered_set<Network>
nets;
190 std::optional<bool>
in_new;
void ReadFromStream(AddrMan &addr, DataStream &ssPeers)
Only used by tests.
static int32_t GetCheckRatio(const NodeContext &node_ctx)
const TestingSetup * g_setup
Stochastic address manager.
size_t Size(std::optional< Network > net=std::nullopt, std::optional< bool > in_new=std::nullopt) const
Return size information about addrman.
bool Good(const CService &addr, NodeSeconds time=Now< NodeSeconds >())
Mark an address record as accessible and attempt to move it to addrman's tried table.
bool Add(const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty=0s)
Attempt to add one or more addresses to addrman's new table.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
A CService with information about it as peer.
A combination of a network address (CNetAddr) and a (TCP) port.
Double ended buffer combining vector and stream-like interfaces.
T ConsumeIntegralInRange(T min, T max)
T PickValueInArray(const T(&array)[size])
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
void FillAddrman(AddrMan &addrman, FuzzedDataProvider &fuzzed_data_provider)
Fill addrman with lots of addresses from lots of sources.
CNetAddr RandAddr(FuzzedDataProvider &fuzzed_data_provider, FastRandomContext &fast_random_context)
Generate a random address.
void initialize_addrman()
CAddress ConsumeAddress(FuzzedDataProvider &fuzzed_data_provider) noexcept
CNetAddr ConsumeNetAddr(FuzzedDataProvider &fuzzed_data_provider, FastRandomContext *rand) noexcept
Create a CNetAddr.
CService ConsumeService(FuzzedDataProvider &fuzzed_data_provider) noexcept
NetGroupManager ConsumeNetGroupManager(FuzzedDataProvider &fuzzed_data_provider) noexcept
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
std::chrono::seconds ConsumeDuration(FuzzedDataProvider &fuzzed_data_provider, std::chrono::seconds min, std::chrono::seconds max) noexcept
WeakEnumType ConsumeWeakEnum(FuzzedDataProvider &fuzzed_data_provider, const WeakEnumType(&all_types)[size]) noexcept
DataStream ConsumeDataStream(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
constexpr ServiceFlags ALL_SERVICE_FLAGS[]
constexpr auto ALL_NETWORKS
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
@ ZEROS
Seed with a compile time constant of zeros.
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider