Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/main.cpp
#include "address.h" | |||||
#include "bitcoin.h" | #include "bitcoin.h" | ||||
#include "clientversion.h" | #include "clientversion.h" | ||||
#include "db.h" | #include "db.h" | ||||
#include "dns.h" | #include "dns.h" | ||||
#include "streams.h" | #include "streams.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <atomic> | #include <atomic> | ||||
#include <cinttypes> | #include <cinttypes> | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <getopt.h> | #include <getopt.h> | ||||
#include <pthread.h> | #include <pthread.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
bool fTestNet = false; | |||||
class CDnsSeedOpts { | class CDnsSeedOpts { | ||||
public: | public: | ||||
int nThreads; | int nThreads; | ||||
int nPort; | int nPort; | ||||
int nDnsThreads; | int nDnsThreads; | ||||
int fUseTestNet; | int fUseTestNet; | ||||
int fWipeBan; | int fWipeBan; | ||||
int fWipeIgnore; | int fWipeIgnore; | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | do { | ||||
int64_t now = time(nullptr); | int64_t now = time(nullptr); | ||||
if (ips.empty()) { | if (ips.empty()) { | ||||
wait *= 1000; | wait *= 1000; | ||||
wait += rand() % (500 * *nThreads); | wait += rand() % (500 * *nThreads); | ||||
Sleep(wait); | Sleep(wait); | ||||
continue; | continue; | ||||
} | } | ||||
std::vector<CAddress> addr; | std::vector<CSeederAddress> addr; | ||||
for (size_t i = 0; i < ips.size(); i++) { | for (size_t i = 0; i < ips.size(); i++) { | ||||
CSeederServiceResult &res = ips[i]; | CSeederServiceResult &res = ips[i]; | ||||
res.nBanTime = 0; | res.nBanTime = 0; | ||||
res.nClientV = 0; | res.nClientV = 0; | ||||
res.nHeight = 0; | res.nHeight = 0; | ||||
res.strClientV = ""; | res.strClientV = ""; | ||||
bool getaddr = res.ourLastSuccess + 86400 < now; | bool getaddr = res.ourLastSuccess + 86400 < now; | ||||
res.fGood = TestNode(res.service, res.nBanTime, res.nClientV, | res.fGood = TestNode(res.service, res.nBanTime, res.nClientV, | ||||
▲ Show 20 Lines • Show All 307 Lines • ▼ Show 20 Lines | if (opts.ipv6_proxy) { | ||||
printf("Using IPv6 proxy at %s\n", | printf("Using IPv6 proxy at %s\n", | ||||
service.ToStringIPPort().c_str()); | service.ToStringIPPort().c_str()); | ||||
SetProxy(NET_IPV6, service); | SetProxy(NET_IPV6, service); | ||||
} | } | ||||
} | } | ||||
bool fDNS = true; | bool fDNS = true; | ||||
if (opts.fUseTestNet) { | if (opts.fUseTestNet) { | ||||
printf("Using testnet.\n"); | printf("Using testnet.\n"); | ||||
pchMessageStart[0] = 0xf4; | netMagic[0] = 0xf4; | ||||
pchMessageStart[1] = 0xe5; | netMagic[1] = 0xe5; | ||||
pchMessageStart[2] = 0xf3; | netMagic[2] = 0xf3; | ||||
pchMessageStart[3] = 0xf4; | netMagic[3] = 0xf4; | ||||
seeds = testnet_seeds; | seeds = testnet_seeds; | ||||
fTestNet = true; | fTestNet = true; | ||||
} | } | ||||
if (!opts.ns) { | if (!opts.ns) { | ||||
printf("No nameserver set. Not starting DNS server.\n"); | printf("No nameserver set. Not starting DNS server.\n"); | ||||
fDNS = false; | fDNS = false; | ||||
} | } | ||||
if (fDNS && !opts.host) { | if (fDNS && !opts.host) { | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |