server: disable DNS boostrap for SigNet nodes

In this commit, we fix a bug that would cause nodes attempting to run
using the signet chain, to waste CPU as they attempted to boostrap to a
non-existent DNS seed. We fix this by ignoring the DNS boostrapper is
signet is active. Along the way, we refactor the conditional sightly to
be more readable, and easily extensible.
This commit is contained in:
Olaoluwa Osuntokun
2021-07-23 16:50:45 -07:00
parent 4c010e803e
commit 6b1696c4f2

View File

@@ -1788,10 +1788,11 @@ func (s *server) Start() error {
// configure the set of active bootstrappers, and launch a
// dedicated goroutine to maintain a set of persistent
// connections.
if !s.cfg.NoNetBootstrap &&
!(s.cfg.Bitcoin.SimNet || s.cfg.Litecoin.SimNet) &&
!(s.cfg.Bitcoin.RegTest || s.cfg.Litecoin.RegTest) {
isSimnet := (s.cfg.Bitcoin.SimNet || s.cfg.Litecoin.SimNet)
isSignet := (s.cfg.Bitcoin.SigNet || s.cfg.Litecoin.SigNet)
isRegtest := (s.cfg.Bitcoin.RegTest || s.cfg.Litecoin.RegTest)
isDevNetwork := isSimnet || isSignet || isRegtest
if !s.cfg.NoNetBootstrap && !isDevNetwork {
bootstrappers, err := initNetworkBootstrappers(s)
if err != nil {
startErr = err