Browse Source

Merge pull request #2237 from petertodd/testnet-dnsseed

Add DNS seed support for testnet
miguelfreitas
Jeff Garzik 12 years ago
parent
commit
353b7f4a9c
  1. 15
      src/net.cpp

15
src/net.cpp

@ -1145,11 +1145,17 @@ void MapPort()
// Each pair gives a source name and a seed name. // Each pair gives a source name and a seed name.
// The first name is used as information source for addrman. // The first name is used as information source for addrman.
// The second name should resolve to a list of seed addresses. // The second name should resolve to a list of seed addresses.
static const char *strDNSSeed[][2] = { static const char *strMainNetDNSSeed[][2] = {
{"bitcoin.sipa.be", "seed.bitcoin.sipa.be"}, {"bitcoin.sipa.be", "seed.bitcoin.sipa.be"},
{"bluematt.me", "dnsseed.bluematt.me"}, {"bluematt.me", "dnsseed.bluematt.me"},
{"dashjr.org", "dnsseed.bitcoin.dashjr.org"}, {"dashjr.org", "dnsseed.bitcoin.dashjr.org"},
{"xf2.org", "bitseed.xf2.org"}, {"xf2.org", "bitseed.xf2.org"},
{NULL, NULL}
};
static const char *strTestNetDNSSeed[][2] = {
{"bitcoin.petertodd.org", "testnet-seed.bitcoin.petertodd.org"},
{NULL, NULL}
}; };
void ThreadDNSAddressSeed(void* parg) void ThreadDNSAddressSeed(void* parg)
@ -1175,14 +1181,14 @@ void ThreadDNSAddressSeed(void* parg)
void ThreadDNSAddressSeed2(void* parg) void ThreadDNSAddressSeed2(void* parg)
{ {
static const char *(*strDNSSeed)[2] = fTestNet ? strTestNetDNSSeed : strMainNetDNSSeed;
printf("ThreadDNSAddressSeed started\n"); printf("ThreadDNSAddressSeed started\n");
int found = 0; int found = 0;
if (!fTestNet)
{
printf("Loading addresses from DNS seeds (could take a while)\n"); printf("Loading addresses from DNS seeds (could take a while)\n");
for (unsigned int seed_idx = 0; seed_idx < ARRAYLEN(strDNSSeed); seed_idx++) { for (unsigned int seed_idx = 0; strDNSSeed[seed_idx][0] != NULL; seed_idx++) {
if (HaveNameProxy()) { if (HaveNameProxy()) {
AddOneShot(strDNSSeed[seed_idx][1]); AddOneShot(strDNSSeed[seed_idx][1]);
} else { } else {
@ -1202,7 +1208,6 @@ void ThreadDNSAddressSeed2(void* parg)
addrman.Add(vAdd, CNetAddr(strDNSSeed[seed_idx][0], true)); addrman.Add(vAdd, CNetAddr(strDNSSeed[seed_idx][0], true));
} }
} }
}
printf("%d addresses found from DNS seeds\n", found); printf("%d addresses found from DNS seeds\n", found);
} }

Loading…
Cancel
Save