server: lookup DNS seeds directly by active chain's genesis hash

In this commit, we fix a bug that would cause the DNS seeds to be
*always* active regardless of which chain+network we were on. Before we
would look up the network in the reverseChainMap. However, if we were
on regtest or testate, then it would still (incorrectly) resolve to a
valid hash.

To remedy this, we now directly use the genesis hash of the current
active chain.
This commit is contained in:
Olaoluwa Osuntokun 2017-12-02 18:05:43 -08:00
parent 30b4ab2c74
commit 724adb158c
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
1 changed files with 1 additions and 2 deletions

View File

@ -502,8 +502,7 @@ func initNetworkBootstrappers(s *server) ([]discovery.NetworkPeerBootstrapper, e
// If this isn't simnet mode, then one of our additional bootstrapping
// sources will be the set of running DNS seeds.
if !cfg.Bitcoin.SimNet || !cfg.Litecoin.SimNet {
chainHash := reverseChainMap[registeredChains.PrimaryChain()]
dnsSeeds, ok := chainDNSSeeds[chainHash]
dnsSeeds, ok := chainDNSSeeds[*activeNetParams.GenesisHash]
// If we have a set of DNS seeds for this chain, then we'll add
// it as an additional boostrapping source.