Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
dnsseeds.cpp
Go to the documentation of this file.
1// Copyright (c) 2021 The Bitcoin 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 <dnsseeds.h>
6
7#include <common/args.h>
8#include <random.h>
9
10const std::vector<std::string>
13 std::vector<std::string> seeds;
14 if (gArgs.IsArgSet("-overridednsseed")) {
15 seeds = {gArgs.GetArg("-overridednsseed", "")};
16 } else {
17 seeds = params.vSeeds;
18 }
19
20 Shuffle(seeds.begin(), seeds.end(), rng);
21 return seeds;
22}
ArgsManager gArgs
Definition args.cpp:38
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
Definition args.cpp:381
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition args.cpp:494
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition chainparams.h:80
std::vector< std::string > vSeeds
Fast randomness source.
Definition random.h:156
const std::vector< std::string > GetRandomizedDNSSeeds(const CChainParams &params)
Return the list of hostnames to look up for DNS seeds.
Definition dnsseeds.cpp:11
void Shuffle(I first, I last, R &&rng)
More efficient than using std::shuffle on a FastRandomContext.
Definition random.h:291
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85