Skip to content

Commit 3ac384e

Browse files
committed
chore: avoid trying bootstrapping for single bootstrapper
1 parent b25e2c0 commit 3ac384e

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

rolling-shutter/p2p/bootstrap.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,20 @@ func bootstrap(
7979
}
8080

8181
if config.IsBootstrapNode {
82-
// A bootstrap node is not required to connect to other bootstrap nodes.
83-
// If however we did configure a list of bootstrap nodes,
84-
// we should try a long time to connect to at least one other bootstrapper first.
85-
_, err := retry.FunctionCall(
86-
ctx,
87-
f,
88-
retry.MaxInterval(5*time.Hour),
89-
retry.StopOnErrors(errInsufficientBootstrpConfigured),
90-
retry.Interval(2*time.Minute))
91-
if err != nil {
92-
log.Error().Err(err).
93-
Msg("failed to bootstrap, continuing without peer connections.")
82+
if len(config.BootstrapPeers) > 0 {
83+
// A bootstrap node is not required to connect to other bootstrap nodes.
84+
// If however we did configure a list of bootstrap nodes,
85+
// we should try a long time to connect to at least one other bootstrapper first.
86+
_, err := retry.FunctionCall(
87+
ctx,
88+
f,
89+
retry.MaxInterval(5*time.Hour),
90+
retry.StopOnErrors(errInsufficientBootstrpConfigured),
91+
retry.Interval(2*time.Minute))
92+
if err != nil {
93+
log.Error().Err(err).
94+
Msg("failed to bootstrap, continuing without peer connections.")
95+
}
9496
}
9597
} else {
9698
_, err := retry.FunctionCall(

0 commit comments

Comments
 (0)