chaincfg: Move DNS Seeds to chaincfg.
This allows API users access to the DNS Seeds for use with SPV clients, seeders, etc.
This commit is contained in:
parent
aa0efa1f3e
commit
cb71f278ec
3 changed files with 24 additions and 24 deletions
|
@ -55,6 +55,7 @@ type Params struct {
|
|||
Name string
|
||||
Net wire.BitcoinNet
|
||||
DefaultPort string
|
||||
DNSSeeds []string
|
||||
|
||||
// Chain parameters
|
||||
GenesisBlock *wire.MsgBlock
|
||||
|
@ -101,6 +102,15 @@ var MainNetParams = Params{
|
|||
Name: "mainnet",
|
||||
Net: wire.MainNet,
|
||||
DefaultPort: "8333",
|
||||
DNSSeeds: []string{
|
||||
"seed.bitcoin.sipa.be",
|
||||
"dnsseed.bluematt.me",
|
||||
"dnsseed.bitcoin.dashjr.org",
|
||||
"seed.bitcoinstats.com",
|
||||
"seed.bitnodes.io",
|
||||
"bitseed.xf2.org",
|
||||
"seed.bitcoin.jonasschnelli.ch",
|
||||
},
|
||||
|
||||
// Chain parameters
|
||||
GenesisBlock: &genesisBlock,
|
||||
|
@ -166,6 +176,7 @@ var RegressionNetParams = Params{
|
|||
Name: "regtest",
|
||||
Net: wire.TestNet,
|
||||
DefaultPort: "18444",
|
||||
DNSSeeds: []string{},
|
||||
|
||||
// Chain parameters
|
||||
GenesisBlock: ®TestGenesisBlock,
|
||||
|
@ -213,6 +224,12 @@ var TestNet3Params = Params{
|
|||
Name: "testnet3",
|
||||
Net: wire.TestNet3,
|
||||
DefaultPort: "18333",
|
||||
DNSSeeds: []string{
|
||||
"testnet-seed.alexykot.me",
|
||||
"testnet-seed.bitcoin.schildbach.de",
|
||||
"testnet-seed.bitcoin.petertodd.org",
|
||||
"testnet-seed.bluematt.me",
|
||||
},
|
||||
|
||||
// Chain parameters
|
||||
GenesisBlock: &testNet3GenesisBlock,
|
||||
|
@ -266,6 +283,7 @@ var SimNetParams = Params{
|
|||
Name: "simnet",
|
||||
Net: wire.SimNet,
|
||||
DefaultPort: "18555",
|
||||
DNSSeeds: []string{}, // NOTE: There must NOT be any seeds.
|
||||
|
||||
// Chain parameters
|
||||
GenesisBlock: &simNetGenesisBlock,
|
||||
|
|
18
params.go
18
params.go
|
@ -18,7 +18,6 @@ var activeNetParams = &mainNetParams
|
|||
type params struct {
|
||||
*chaincfg.Params
|
||||
rpcPort string
|
||||
dnsSeeds []string
|
||||
}
|
||||
|
||||
// mainNetParams contains parameters specific to the main network
|
||||
|
@ -30,15 +29,6 @@ type params struct {
|
|||
var mainNetParams = params{
|
||||
Params: &chaincfg.MainNetParams,
|
||||
rpcPort: "8334",
|
||||
dnsSeeds: []string{
|
||||
"seed.bitcoin.sipa.be",
|
||||
"dnsseed.bluematt.me",
|
||||
"dnsseed.bitcoin.dashjr.org",
|
||||
"seed.bitcoinstats.com",
|
||||
"seed.bitnodes.io",
|
||||
"bitseed.xf2.org",
|
||||
"seed.bitcoin.jonasschnelli.ch",
|
||||
},
|
||||
}
|
||||
|
||||
// regressionNetParams contains parameters specific to the regression test
|
||||
|
@ -48,7 +38,6 @@ var mainNetParams = params{
|
|||
var regressionNetParams = params{
|
||||
Params: &chaincfg.RegressionNetParams,
|
||||
rpcPort: "18334",
|
||||
dnsSeeds: []string{},
|
||||
}
|
||||
|
||||
// testNet3Params contains parameters specific to the test network (version 3)
|
||||
|
@ -57,12 +46,6 @@ var regressionNetParams = params{
|
|||
var testNet3Params = params{
|
||||
Params: &chaincfg.TestNet3Params,
|
||||
rpcPort: "18334",
|
||||
dnsSeeds: []string{
|
||||
"testnet-seed.alexykot.me",
|
||||
"testnet-seed.bitcoin.schildbach.de",
|
||||
"testnet-seed.bitcoin.petertodd.org",
|
||||
"testnet-seed.bluematt.me",
|
||||
},
|
||||
}
|
||||
|
||||
// simNetParams contains parameters specific to the simulation test network
|
||||
|
@ -70,7 +53,6 @@ var testNet3Params = params{
|
|||
var simNetParams = params{
|
||||
Params: &chaincfg.SimNetParams,
|
||||
rpcPort: "18556",
|
||||
dnsSeeds: []string{}, // NOTE: There must NOT be any seeds.
|
||||
}
|
||||
|
||||
// netName returns the name used when referring to a bitcoin network. At the
|
||||
|
|
|
@ -1429,7 +1429,7 @@ func (s *server) seedFromDNS() {
|
|||
return
|
||||
}
|
||||
|
||||
for _, seeder := range activeNetParams.dnsSeeds {
|
||||
for _, seeder := range activeNetParams.DNSSeeds {
|
||||
go func(seeder string) {
|
||||
randSource := mrand.New(mrand.NewSource(time.Now().UnixNano()))
|
||||
|
||||
|
|
Loading…
Reference in a new issue