diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-11-08 03:39:08 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-11-08 03:39:08 +0800 |
commit | cf3b187bdef59078ba6570a2f5ee046ab87bcefd (patch) | |
tree | fbc16d9216df0d32e745f88cb3ac22e6dab256bf /swarm/network | |
parent | 81533deae5ee4a7ec08842e2b6647f3affde5a71 (diff) | |
download | dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar.gz dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar.bz2 dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar.lz dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar.xz dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar.zst dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.zip |
swarm, cmd/swarm: address ineffectual assignments (#18048)
* swarm, cmd/swarm: address ineffectual assignments
* swarm/network: remove unused vars from testHandshake
* swarm/storage/feed: revert cursor changes
Diffstat (limited to 'swarm/network')
-rw-r--r-- | swarm/network/hive_test.go | 6 | ||||
-rw-r--r-- | swarm/network/protocol_test.go | 12 | ||||
-rw-r--r-- | swarm/network/simulation/bucket_test.go | 4 | ||||
-rw-r--r-- | swarm/network/stream/syncer_test.go | 3 |
4 files changed, 12 insertions, 13 deletions
diff --git a/swarm/network/hive_test.go b/swarm/network/hive_test.go index 059c3dc96..56adc5a8e 100644 --- a/swarm/network/hive_test.go +++ b/swarm/network/hive_test.go @@ -70,6 +70,9 @@ func TestHiveStatePersistance(t *testing.T) { defer os.RemoveAll(dir) store, err := state.NewDBStore(dir) //start the hive with an empty dbstore + if err != nil { + t.Fatal(err) + } params := NewHiveParams() s, pp := newHiveTester(t, params, 5, store) @@ -90,6 +93,9 @@ func TestHiveStatePersistance(t *testing.T) { store.Close() persistedStore, err := state.NewDBStore(dir) //start the hive with an empty dbstore + if err != nil { + t.Fatal(err) + } s1, pp := newHiveTester(t, params, 1, persistedStore) diff --git a/swarm/network/protocol_test.go b/swarm/network/protocol_test.go index cdf370f35..f0d266628 100644 --- a/swarm/network/protocol_test.go +++ b/swarm/network/protocol_test.go @@ -153,17 +153,7 @@ func newBzzHandshakeTester(t *testing.T, n int, addr *BzzAddr, lightNode bool) * // should test handshakes in one exchange? parallelisation func (s *bzzTester) testHandshake(lhs, rhs *HandshakeMsg, disconnects ...*p2ptest.Disconnect) error { - var peers []enode.ID - id := rhs.Addr.ID() - if len(disconnects) > 0 { - for _, d := range disconnects { - peers = append(peers, d.Peer) - } - } else { - peers = []enode.ID{id} - } - - if err := s.TestExchanges(HandshakeMsgExchange(lhs, rhs, id)...); err != nil { + if err := s.TestExchanges(HandshakeMsgExchange(lhs, rhs, rhs.Addr.ID())...); err != nil { return err } diff --git a/swarm/network/simulation/bucket_test.go b/swarm/network/simulation/bucket_test.go index 461d99825..69df19bfe 100644 --- a/swarm/network/simulation/bucket_test.go +++ b/swarm/network/simulation/bucket_test.go @@ -94,7 +94,7 @@ func TestServiceBucket(t *testing.T) { t.Fatalf("expected %q, got %q", customValue, s) } - v, ok = sim.NodeItem(id2, customKey) + _, ok = sim.NodeItem(id2, customKey) if ok { t.Fatal("bucket item should not be found") } @@ -119,7 +119,7 @@ func TestServiceBucket(t *testing.T) { t.Fatalf("expected %q, got %q", testValue+id1.String(), s) } - v, ok = items[id2] + _, ok = items[id2] if ok { t.Errorf("node 2 item should not be found") } diff --git a/swarm/network/stream/syncer_test.go b/swarm/network/stream/syncer_test.go index 113807b98..b0e35b0db 100644 --- a/swarm/network/stream/syncer_test.go +++ b/swarm/network/stream/syncer_test.go @@ -62,6 +62,9 @@ func createMockStore(globalStore *mockdb.GlobalStore, id enode.ID, addr *network params.Init(datadir) params.BaseKey = addr.Over() lstore, err = storage.NewLocalStore(params, mockStore) + if err != nil { + return nil, "", err + } return lstore, datadir, nil } |