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/api | |
parent | 81533deae5ee4a7ec08842e2b6647f3affde5a71 (diff) | |
download | dexon-cf3b187bdef59078ba6570a2f5ee046ab87bcefd.tar.gz 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/api')
-rw-r--r-- | swarm/api/act.go | 3 | ||||
-rw-r--r-- | swarm/api/client/client_test.go | 3 | ||||
-rw-r--r-- | swarm/api/filesystem.go | 4 | ||||
-rw-r--r-- | swarm/api/http/server.go | 2 | ||||
-rw-r--r-- | swarm/api/http/server_test.go | 5 | ||||
-rw-r--r-- | swarm/api/manifest.go | 1 |
6 files changed, 15 insertions, 3 deletions
diff --git a/swarm/api/act.go b/swarm/api/act.go index 52d909827..e54369f9a 100644 --- a/swarm/api/act.go +++ b/swarm/api/act.go @@ -458,6 +458,9 @@ func DoACT(ctx *cli.Context, privateKey *ecdsa.PrivateKey, salt []byte, grantees return nil, nil, nil, err } sessionKey, err := NewSessionKeyPK(privateKey, granteePub, salt) + if err != nil { + return nil, nil, nil, err + } hasher := sha3.NewKeccak256() hasher.Write(append(sessionKey, 0)) diff --git a/swarm/api/client/client_test.go b/swarm/api/client/client_test.go index 03c6cbb28..c30d69911 100644 --- a/swarm/api/client/client_test.go +++ b/swarm/api/client/client_test.go @@ -457,6 +457,9 @@ func TestClientCreateUpdateFeed(t *testing.T) { } feedManifestHash, err := client.CreateFeedWithManifest(createRequest) + if err != nil { + t.Fatal(err) + } correctManifestAddrHex := "0e9b645ebc3da167b1d56399adc3276f7a08229301b72a03336be0e7d4b71882" if feedManifestHash != correctManifestAddrHex { diff --git a/swarm/api/filesystem.go b/swarm/api/filesystem.go index 43695efc1..266ef71be 100644 --- a/swarm/api/filesystem.go +++ b/swarm/api/filesystem.go @@ -122,6 +122,10 @@ func (fs *FileSystem) Upload(lpath, index string, toEncrypt bool) (string, error var wait func(context.Context) error ctx := context.TODO() hash, wait, err = fs.api.fileStore.Store(ctx, f, stat.Size(), toEncrypt) + if err != nil { + errors[i] = err + return + } if hash != nil { list[i].Hash = hash.Hex() } diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go index 803b78987..3c6735a73 100644 --- a/swarm/api/http/server.go +++ b/swarm/api/http/server.go @@ -366,7 +366,7 @@ func (s *Server) handleMultipartUpload(r *http.Request, boundary string, mw *api } var size int64 - var reader io.Reader = part + var reader io.Reader if contentLength := part.Header.Get("Content-Length"); contentLength != "" { size, err = strconv.ParseInt(contentLength, 10, 64) if err != nil { diff --git a/swarm/api/http/server_test.go b/swarm/api/http/server_test.go index 159c8a159..04d0e045a 100644 --- a/swarm/api/http/server_test.go +++ b/swarm/api/http/server_test.go @@ -263,7 +263,7 @@ func TestBzzFeed(t *testing.T) { if resp.StatusCode == http.StatusOK { t.Fatal("Expected error status since feed update does not contain multihash. Received 200 OK") } - b, err = ioutil.ReadAll(resp.Body) + _, err = ioutil.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -491,6 +491,9 @@ func testBzzGetPath(encrypted bool, t *testing.T) { } defer resp.Body.Close() respbody, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatalf("Error while reading response body: %v", err) + } if string(respbody) != testmanifest[v] { isexpectedfailrequest := false diff --git a/swarm/api/manifest.go b/swarm/api/manifest.go index 7c4cc88e4..890ed88bd 100644 --- a/swarm/api/manifest.go +++ b/swarm/api/manifest.go @@ -557,7 +557,6 @@ func (mt *manifestTrie) findPrefixOf(path string, quitC chan bool) (entry *manif if path != entry.Path { return nil, 0 } - pos = epl } } return nil, 0 |