Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/api/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/ethersphere/bee/v2/pkg/file/redundancy"
"github.com/ethersphere/bee/v2/pkg/jsonhttp"
"github.com/ethersphere/bee/v2/pkg/replicas"
"github.com/ethersphere/bee/v2/pkg/storage"
"github.com/ethersphere/bee/v2/pkg/storer"
"github.com/ethersphere/bee/v2/pkg/swarm"
Expand Down Expand Up @@ -52,7 +53,7 @@ func (s *Service) pinRootHash(w http.ResponseWriter, r *http.Request) {
return
}

getter := s.storer.Download(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this does what we need.
What caused the problem and how did you fix it?

Honestly, I dont this replicas (as opposed to parities) should be pinned at all, cos they are the same as the root chunk. When it comes to repair it should just upload the replicas too to swarm .

Also it is very suspicious that redundancy.DefaultLevel is used here. You know the level of a pinned file we can assume, no?

Copy link
Member Author

@gacevicljubisa gacevicljubisa Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea behind this PR was to addresses just specific comment in issue #5228 .

Thanks for clarifying that replicas shouldn't be pinned.
I used redundancy.DefaultLevel as an assumption, and it is much used all over the codebase. Recently I created new issue related to the use of redundancy.DefaultLevel and inconsistent Swarm-Redundancy-Level header.

I wasn't aware we can extract the redundancy level from the pinned file.

Can you suggest me the flow, how pinning should be handled if route chunk can not be found?

Also, how we can repair by uploading the replicas too to swarm?

getter := replicas.NewGetter(s.storer.Download(true), redundancy.DefaultLevel)
traverser := traversal.New(getter, s.storer.Cache(), redundancy.DefaultLevel)

sem := semaphore.NewWeighted(100)
Expand Down
Loading