Commit 6d4c8ba6 authored by metacertain's avatar metacertain Committed by GitHub

fix: origin credit in replication (#2127)

parent f1fa3b44
...@@ -308,7 +308,7 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo ...@@ -308,7 +308,7 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
return true, false, nil return true, false, nil
} }
count++ count++
go ps.pushToNeighbour(peer, ch) go ps.pushToNeighbour(peer, ch, retryAllowed)
return false, false, nil return false, false, nil
}) })
return nil, err return nil, err
...@@ -433,7 +433,7 @@ func (ps *PushSync) pushPeer(ctx context.Context, peer swarm.Address, ch swarm.C ...@@ -433,7 +433,7 @@ func (ps *PushSync) pushPeer(ctx context.Context, peer swarm.Address, ch swarm.C
} }
// pushToNeighbour handles in-neighborhood replication for a single peer. // pushToNeighbour handles in-neighborhood replication for a single peer.
func (ps *PushSync) pushToNeighbour(peer swarm.Address, ch swarm.Chunk) { func (ps *PushSync) pushToNeighbour(peer swarm.Address, ch swarm.Chunk, origin bool) {
var err error var err error
defer func() { defer func() {
if err != nil { if err != nil {
...@@ -496,7 +496,7 @@ func (ps *PushSync) pushToNeighbour(peer swarm.Address, ch swarm.Chunk) { ...@@ -496,7 +496,7 @@ func (ps *PushSync) pushToNeighbour(peer swarm.Address, ch swarm.Chunk) {
return return
} }
err = ps.accounting.Credit(peer, receiptPrice, false) err = ps.accounting.Credit(peer, receiptPrice, origin)
} }
type peerSkipList struct { type peerSkipList struct {
......
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