diff --git a/pkg/file/pipeline/hashtrie/hashtrie.go b/pkg/file/pipeline/hashtrie/hashtrie.go index e63577da0e4..530d04c820d 100644 --- a/pkg/file/pipeline/hashtrie/hashtrie.go +++ b/pkg/file/pipeline/hashtrie/hashtrie.go @@ -222,7 +222,7 @@ func (h *hashTrieWriter) Sum() ([]byte, error) { if err != nil { return nil, err } - // update counters, substracting from current level is not necessary + // update counters, subtracting from current level is not necessary h.effectiveChunkCounters[i+1]++ h.chunkCounters[i+1]++ default: diff --git a/pkg/file/redundancy/redundancy.go b/pkg/file/redundancy/redundancy.go index 26ed7a74e3a..0a34129690a 100644 --- a/pkg/file/redundancy/redundancy.go +++ b/pkg/file/redundancy/redundancy.go @@ -154,7 +154,10 @@ func (p *Params) encode(chunkLevel int, callback ParityChunkCallback) error { for i := shards; i < n; i++ { p.buffer[chunkLevel][i] = make([]byte, pz) } - enc.Encode(p.buffer[chunkLevel][:n]) + err = enc.Encode(p.buffer[chunkLevel][:n]) + if err != nil { + return err + } // store and pass newly created parity chunks for i := shards; i < n; i++ { chunkData := p.buffer[chunkLevel][i] diff --git a/pkg/file/redundancy/redundancy_test.go b/pkg/file/redundancy/redundancy_test.go index 31c99035411..a968cb43386 100644 --- a/pkg/file/redundancy/redundancy_test.go +++ b/pkg/file/redundancy/redundancy_test.go @@ -115,12 +115,21 @@ func TestEncode(t *testing.T) { for i := 0; i < shardCount; i++ { buffer := make([]byte, 32) - io.ReadFull(rand.Reader, buffer) - params.ChunkWrite(0, buffer, parityCallback) + _, err := io.ReadFull(rand.Reader, buffer) + if err != nil { + t.Error(err) + } + err = params.ChunkWrite(0, buffer, parityCallback) + if err != nil { + t.Error(err) + } } if shardCount != maxShards { // encode should be called automatically when reaching maxshards - params.Encode(0, parityCallback) + err := params.Encode(0, parityCallback) + if err != nil { + t.Error(err) + } } // CHECKS