From 6b1696c4f2200e2d46131c748fe7ec76835cb180 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 23 Jul 2021 16:50:45 -0700 Subject: [PATCH] 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. --- server.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server.go b/server.go index b21c71a47..0ab1abaaf 100644 --- a/server.go +++ b/server.go @@ -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