Commit b4db606f authored by istae's avatar istae Committed by GitHub

fix: replicate with peers further from the chunk (#2293)

parent 189ce9a1
...@@ -335,6 +335,12 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo ...@@ -335,6 +335,12 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
return false, false, nil return false, false, nil
} }
// here we skip the peer if the peer is closer to the chunk than us
// we replicate with peers that are further away than us because we are the storer
if dcmp, _ := swarm.DistanceCmp(ch.Address().Bytes(), peer.Bytes(), ps.address.Bytes()); dcmp == 1 {
return false, false, nil
}
if count == nPeersToPushsync { if count == nPeersToPushsync {
return true, false, nil return true, false, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment