aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/network
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/network')
-rw-r--r--swarm/network/simulation/bucket.go2
-rw-r--r--swarm/network/simulation/bucket_test.go2
-rw-r--r--swarm/network/simulation/example_test.go2
-rw-r--r--swarm/network/simulation/kademlia.go2
-rw-r--r--swarm/network/simulation/node.go6
-rw-r--r--swarm/network/simulation/simulation_test.go6
-rw-r--r--swarm/network/stream/delivery_test.go24
-rw-r--r--swarm/network/stream/syncer_test.go10
8 files changed, 27 insertions, 27 deletions
diff --git a/swarm/network/simulation/bucket.go b/swarm/network/simulation/bucket.go
index bd15ea2ab..49a1f4309 100644
--- a/swarm/network/simulation/bucket.go
+++ b/swarm/network/simulation/bucket.go
@@ -21,7 +21,7 @@ import "github.com/ethereum/go-ethereum/p2p/enode"
// BucketKey is the type that should be used for keys in simulation buckets.
type BucketKey string
-// NodeItem returns an item set in ServiceFunc function for a particualar node.
+// NodeItem returns an item set in ServiceFunc function for a particular node.
func (s *Simulation) NodeItem(id enode.ID, key interface{}) (value interface{}, ok bool) {
s.mu.Lock()
defer s.mu.Unlock()
diff --git a/swarm/network/simulation/bucket_test.go b/swarm/network/simulation/bucket_test.go
index 69df19bfe..2273d35a2 100644
--- a/swarm/network/simulation/bucket_test.go
+++ b/swarm/network/simulation/bucket_test.go
@@ -24,7 +24,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
)
-// TestServiceBucket tests all bucket functionalities using subtests.
+// TestServiceBucket tests all bucket functionality using subtests.
// It constructs a simulation of two nodes by adding items to their buckets
// in ServiceFunc constructor, then by SetNodeItem. Testing UpNodesItems
// is done by stopping one node and validating availability of its items.
diff --git a/swarm/network/simulation/example_test.go b/swarm/network/simulation/example_test.go
index a100ede51..e9a360dfd 100644
--- a/swarm/network/simulation/example_test.go
+++ b/swarm/network/simulation/example_test.go
@@ -25,7 +25,7 @@ import (
// Every node can have a Kademlia associated using the node bucket under
// BucketKeyKademlia key. This allows to use WaitTillHealthy to block until
-// all nodes have the their Kadmlias healthy.
+// all nodes have the their Kademlias healthy.
func ExampleSimulation_WaitTillHealthy() {
log.Error("temporarily disabled as simulations.WaitTillHealthy cannot be trusted")
diff --git a/swarm/network/simulation/kademlia.go b/swarm/network/simulation/kademlia.go
index 25bb0f6a9..ebec468f1 100644
--- a/swarm/network/simulation/kademlia.go
+++ b/swarm/network/simulation/kademlia.go
@@ -28,7 +28,7 @@ import (
)
// BucketKeyKademlia is the key to be used for storing the kademlia
-// instance for particuar node, usually inside the ServiceFunc function.
+// instance for particular node, usually inside the ServiceFunc function.
var BucketKeyKademlia BucketKey = "kademlia"
// WaitTillHealthy is blocking until the health of all kademlias is true.
diff --git a/swarm/network/simulation/node.go b/swarm/network/simulation/node.go
index 24b659976..e8d4d6d94 100644
--- a/swarm/network/simulation/node.go
+++ b/swarm/network/simulation/node.go
@@ -195,9 +195,9 @@ func (s *Simulation) AddNodesAndConnectStar(count int, opts ...AddNodeOption) (i
return ids, nil
}
-//UploadSnapshot uploads a snapshot to the simulation
-//This method tries to open the json file provided, applies the config to all nodes
-//and then loads the snapshot into the Simulation network
+// UploadSnapshot uploads a snapshot to the simulation
+// This method tries to open the json file provided, applies the config to all nodes
+// and then loads the snapshot into the Simulation network
func (s *Simulation) UploadSnapshot(snapshotFile string, opts ...AddNodeOption) error {
f, err := os.Open(snapshotFile)
if err != nil {
diff --git a/swarm/network/simulation/simulation_test.go b/swarm/network/simulation/simulation_test.go
index 4667a2abc..f837f9382 100644
--- a/swarm/network/simulation/simulation_test.go
+++ b/swarm/network/simulation/simulation_test.go
@@ -28,7 +28,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/simulations"
"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
- colorable "github.com/mattn/go-colorable"
+ "github.com/mattn/go-colorable"
)
var (
@@ -177,7 +177,7 @@ var noopServiceFuncMap = map[string]ServiceFunc{
}
// a helper function for most basic noop service
-func noopServiceFunc(ctx *adapters.ServiceContext, b *sync.Map) (node.Service, func(), error) {
+func noopServiceFunc(_ *adapters.ServiceContext, _ *sync.Map) (node.Service, func(), error) {
return newNoopService(), nil, nil
}
@@ -188,7 +188,7 @@ func newNoopService() node.Service {
// a helper function for most basic Noop service
// of a different type then NoopService to test
// multiple services on one node.
-func noopService2Func(ctx *adapters.ServiceContext, b *sync.Map) (node.Service, func(), error) {
+func noopService2Func(_ *adapters.ServiceContext, _ *sync.Map) (node.Service, func(), error) {
return new(noopService2), nil, nil
}
diff --git a/swarm/network/stream/delivery_test.go b/swarm/network/stream/delivery_test.go
index 5c1f8c251..04a4bb077 100644
--- a/swarm/network/stream/delivery_test.go
+++ b/swarm/network/stream/delivery_test.go
@@ -442,17 +442,17 @@ func TestStreamerDownstreamChunkDeliveryMsgExchange(t *testing.T) {
}
func TestDeliveryFromNodes(t *testing.T) {
- testDeliveryFromNodes(t, 2, 1, dataChunkCount, true)
- testDeliveryFromNodes(t, 2, 1, dataChunkCount, false)
- testDeliveryFromNodes(t, 4, 1, dataChunkCount, true)
- testDeliveryFromNodes(t, 4, 1, dataChunkCount, false)
- testDeliveryFromNodes(t, 8, 1, dataChunkCount, true)
- testDeliveryFromNodes(t, 8, 1, dataChunkCount, false)
- testDeliveryFromNodes(t, 16, 1, dataChunkCount, true)
- testDeliveryFromNodes(t, 16, 1, dataChunkCount, false)
+ testDeliveryFromNodes(t, 2, dataChunkCount, true)
+ testDeliveryFromNodes(t, 2, dataChunkCount, false)
+ testDeliveryFromNodes(t, 4, dataChunkCount, true)
+ testDeliveryFromNodes(t, 4, dataChunkCount, false)
+ testDeliveryFromNodes(t, 8, dataChunkCount, true)
+ testDeliveryFromNodes(t, 8, dataChunkCount, false)
+ testDeliveryFromNodes(t, 16, dataChunkCount, true)
+ testDeliveryFromNodes(t, 16, dataChunkCount, false)
}
-func testDeliveryFromNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck bool) {
+func testDeliveryFromNodes(t *testing.T, nodes, chunkCount int, skipCheck bool) {
sim := simulation.New(map[string]simulation.ServiceFunc{
"streamer": func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) {
node := ctx.Config.Node()
@@ -609,7 +609,7 @@ func BenchmarkDeliveryFromNodesWithoutCheck(b *testing.B) {
b.Run(
fmt.Sprintf("nodes=%v,chunks=%v", i, chunks),
func(b *testing.B) {
- benchmarkDeliveryFromNodes(b, i, 1, chunks, true)
+ benchmarkDeliveryFromNodes(b, i, chunks, true)
},
)
}
@@ -622,14 +622,14 @@ func BenchmarkDeliveryFromNodesWithCheck(b *testing.B) {
b.Run(
fmt.Sprintf("nodes=%v,chunks=%v", i, chunks),
func(b *testing.B) {
- benchmarkDeliveryFromNodes(b, i, 1, chunks, false)
+ benchmarkDeliveryFromNodes(b, i, chunks, false)
},
)
}
}
}
-func benchmarkDeliveryFromNodes(b *testing.B, nodes, conns, chunkCount int, skipCheck bool) {
+func benchmarkDeliveryFromNodes(b *testing.B, nodes, chunkCount int, skipCheck bool) {
sim := simulation.New(map[string]simulation.ServiceFunc{
"streamer": func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) {
node := ctx.Config.Node()
diff --git a/swarm/network/stream/syncer_test.go b/swarm/network/stream/syncer_test.go
index 27ed49ea4..2fdba71ff 100644
--- a/swarm/network/stream/syncer_test.go
+++ b/swarm/network/stream/syncer_test.go
@@ -43,10 +43,10 @@ import (
const dataChunkCount = 200
func TestSyncerSimulation(t *testing.T) {
- testSyncBetweenNodes(t, 2, 1, dataChunkCount, true, 1)
- testSyncBetweenNodes(t, 4, 1, dataChunkCount, true, 1)
- testSyncBetweenNodes(t, 8, 1, dataChunkCount, true, 1)
- testSyncBetweenNodes(t, 16, 1, dataChunkCount, true, 1)
+ testSyncBetweenNodes(t, 2, dataChunkCount, true, 1)
+ testSyncBetweenNodes(t, 4, dataChunkCount, true, 1)
+ testSyncBetweenNodes(t, 8, dataChunkCount, true, 1)
+ testSyncBetweenNodes(t, 16, dataChunkCount, true, 1)
}
func createMockStore(globalStore mock.GlobalStorer, id enode.ID, addr *network.BzzAddr) (lstore storage.ChunkStore, datadir string, err error) {
@@ -67,7 +67,7 @@ func createMockStore(globalStore mock.GlobalStorer, id enode.ID, addr *network.B
return lstore, datadir, nil
}
-func testSyncBetweenNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck bool, po uint8) {
+func testSyncBetweenNodes(t *testing.T, nodes, chunkCount int, skipCheck bool, po uint8) {
sim := simulation.New(map[string]simulation.ServiceFunc{
"streamer": func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) {