Skip to content

Commit

Permalink
fix(dot/sync): ensure node can be stopped before min peers have been …
Browse files Browse the repository at this point in the history
…acquired (#4291)
  • Loading branch information
haikoschol authored Oct 30, 2024
1 parent 4153087 commit ff8400a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
// DefaultDiscoveryInterval is the default discovery interval
DefaultDiscoveryInterval = 10 * time.Second
// DefaultMinPeers is the default minimum number of peers
DefaultMinPeers = 0
DefaultMinPeers = 5
// DefaultMaxPeers is the default maximum number of peers
DefaultMaxPeers = 50

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/usage/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ These are the flags that can be used with the `gossamer` command
By default, all modules log 'info'.
The global log level can be set with --log global=debug
--max-peers Maximum number of peers to connect to (default 50)
--min-peers Minimum number of peers to connect to (default 0)
--min-peers Minimum number of peers to connect to (default 5)
--name Name of the node
--no-bootstrap Disables network bootstrapping (mdns still enabled)
--no-mdns Disables network mdns discovery
Expand Down
6 changes: 1 addition & 5 deletions dot/sync/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,7 @@ func (s *SyncService) waitWorkers() {
}

err = s.network.BlockAnnounceHandshake(bestBlockHeader)
if err != nil {
if errors.Is(err, network.ErrNoPeersConnected) {
continue
}

if err != nil && !errors.Is(err, network.ErrNoPeersConnected) {
logger.Criticalf("waiting workers: %s", err.Error())
break
}
Expand Down
6 changes: 3 additions & 3 deletions zombienet_tests/functional/0001-basic-network.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ chain = "westend-local"
name = "alice"
command = "gossamer"
validator = true
args = ["--key alice"]
args = ["--key alice", "--min-peers 0"]

[[relaychain.nodes]]
name = "bob"
command = "gossamer"
validator = true
args = ["--key bob"]
args = ["--key bob", "--min-peers 0"]

[[relaychain.nodes]]
name = "charlie"
command = "gossamer"
validator = true
args = ["--key charlie"]
args = ["--key charlie", "--min-peers 0"]

0 comments on commit ff8400a

Please sign in to comment.