diff --git a/pkg/file/joiner/joiner.go b/pkg/file/joiner/joiner.go index 2b91708b031..69ae16065bd 100644 --- a/pkg/file/joiner/joiner.go +++ b/pkg/file/joiner/joiner.go @@ -222,7 +222,7 @@ func (j *joiner) readAtOffset( } // fast forward the cursor - sec := j.subtrieSection(data, cursor, pSize, parity, subTrieSize) + sec := j.subtrieSection(cursor, pSize, parity, subTrieSize) if cur+sec <= off { cur += sec continue @@ -277,7 +277,7 @@ func (j *joiner) getShards(payloadSize, parities int) int { } // brute-forces the subtrie size for each of the sections in this intermediate chunk -func (j *joiner) subtrieSection(data []byte, startIdx, payloadSize, parities int, subtrieSize int64) int64 { +func (j *joiner) subtrieSection(startIdx, payloadSize, parities int, subtrieSize int64) int64 { // assume we have a trie of size `y` then we can assume that all of // the forks except for the last one on the right are of equal size // this is due to how the splitter wraps levels. @@ -375,7 +375,7 @@ func (j *joiner) processChunkAddresses(ctx context.Context, fn swarm.AddressIter if j.refLength == encryption.ReferenceSize { cursor += swarm.HashSize * min(i, shardCnt) } - sec := j.subtrieSection(data, cursor, eSize, parity, subTrieSize) + sec := j.subtrieSection(cursor, eSize, parity, subTrieSize) if sec <= swarm.ChunkSize { continue } diff --git a/pkg/file/redundancy/getter/getter.go b/pkg/file/redundancy/getter/getter.go index ce1181b045d..d0082212d8a 100644 --- a/pkg/file/redundancy/getter/getter.go +++ b/pkg/file/redundancy/getter/getter.go @@ -282,7 +282,7 @@ func (g *decoder) recover(ctx context.Context) error { } // decode using Reed-Solomon decoder - if err := g.decode(ctx); err != nil { + if err := g.decode(); err != nil { return err } @@ -292,7 +292,7 @@ func (g *decoder) recover(ctx context.Context) error { // decode uses Reed-Solomon erasure coding decoder to recover data shards // it must be called after shqrdcnt shards are retrieved -func (g *decoder) decode(ctx context.Context) error { +func (g *decoder) decode() error { g.mu.Lock() defer g.mu.Unlock() diff --git a/pkg/file/redundancy/getter/strategies.go b/pkg/file/redundancy/getter/strategies.go index 410a0003962..7387096c4c6 100644 --- a/pkg/file/redundancy/getter/strategies.go +++ b/pkg/file/redundancy/getter/strategies.go @@ -6,7 +6,6 @@ package getter import ( "context" - "errors" "fmt" "time" @@ -15,8 +14,8 @@ import ( ) const ( - DefaultStrategy = NONE // default prefetching strategy - DefaultStrict = true // default fallback modes + DefaultStrategy = DATA // default prefetching strategy + DefaultStrict = false // default fallback modes DefaultFetchTimeout = retrieval.RetrieveChunkTimeout // timeout for each chunk retrieval DefaultStrategyTimeout = 300 * time.Millisecond // timeout for each strategy ) @@ -60,10 +59,7 @@ var DefaultConfig = Config{ func NewConfigFromContext(ctx context.Context, def Config) (conf Config, err error) { var ok bool conf = def - e := func(s string, errs ...error) error { - if len(errs) > 0 { - return fmt.Errorf("error setting %s from context: %w", s, errors.Join(errs...)) - } + e := func(s string) error { return fmt.Errorf("error setting %s from context", s) } if val := ctx.Value(strategyKey{}); val != nil {