diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -22,3 +22,9 @@ - The `importmulti` RPC will now contain a new per-request `warnings` field with strings that explain when fields are being ignored or inconsistent, if any. + +Seeder +------ +- Added `-connect` and `-addnode` options to the seeder to allow control + over the initial list of ips upon seeder start up. See + `./bitcoin-seeder -help` for more details. diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp --- a/src/seeder/main.cpp +++ b/src/seeder/main.cpp @@ -149,6 +149,19 @@ gArgs.AddArg("-filter=", "Allow these flag combinations as filters", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); + gArgs.AddArg( + "-connect=", + "Determines initial seeder connection behavior. -connect=1 starts " + "the seeder without any initial regulations on ips it can connect " + "to. -connect=0 disbales automatic connection to any initial ips. " + "-connect= prevents connection to all ips except (this is " + "short hand for -connect=0 -addseed=). See also: -addseed. " + "(default: 1)", + ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); + gArgs.AddArg("-addseed=", + "Append to the initial list of allowable " + "connections. Can be set multiple times.", + ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); gArgs.AddArg("-wipeban", "Wipe list of banned nodes", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); gArgs.AddArg("-wipeignore", "Wipe list of ignored nodes", @@ -462,8 +475,19 @@ const static unsigned int MAX_HOSTS_PER_SEED = 128; extern "C" void *ThreadSeeder(void *) { + std::vector seeds; + std::string connect = gArgs.GetArg("-connect", "1"); + if (connect == "1") { + seeds = Params().DNSSeeds(); + } else if (connect != "0") { + seeds.push_back(connect); + } + if (gArgs.IsArgSet("-addseed")) { + auto addedSeeds = gArgs.GetArgs("-addseed"); + seeds.insert(seeds.end(), addedSeeds.begin(), addedSeeds.end()); + } do { - for (const std::string &seed : Params().DNSSeeds()) { + for (const std::string &seed : seeds) { std::vector ips; LookupHost(seed.c_str(), ips, MAX_HOSTS_PER_SEED, true); for (auto &ip : ips) {