Skip to content

Commit

Permalink
swarm/network: fix data race in TestNetworkID test (ethereum#18460)
Browse files Browse the repository at this point in the history
(cherry picked from commit 96c7c18)
  • Loading branch information
janos authored and dshulyak committed Mar 14, 2019
1 parent d901911 commit 6845945
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions swarm/network/networkid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ func TestNetworkID(t *testing.T) {
if err != nil {
t.Fatalf("Error setting up network: %v", err)
}
defer func() {
//shutdown the snapshot network
log.Trace("Shutting down network")
net.Shutdown()
}()
//let's sleep to ensure all nodes are connected
time.Sleep(1 * time.Second)
// shutdown the the network to avoid race conditions
// on accessing kademlias global map while network nodes
// are accepting messages
net.Shutdown()
//for each group sharing the same network ID...
for _, netIDGroup := range nodeMap {
log.Trace("netIDGroup size", "size", len(netIDGroup))
Expand Down

0 comments on commit 6845945

Please sign in to comment.