Bitcoin ABC  0.26.3
P2P Digital Currency
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 <random.h>
8 #include <util/system.h>
9 
10 const 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 }
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
Definition: system.cpp:484
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:584
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition: chainparams.h:74
std::vector< std::string > vSeeds
Definition: chainparams.h:146
Fast randomness source.
Definition: random.h:129
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:251
ArgsManager gArgs
Definition: system.cpp:77