Skip to content

Commit

Permalink
Merge pull request #7202 from ipfs/fix/duplicate-blocks
Browse files Browse the repository at this point in the history
fix: fix duplicate block issue in bitswap
  • Loading branch information
Stebalien authored Apr 23, 2020
2 parents 8cb67ab + 5d13ac3 commit 6f1cedd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 94 deletions.
9 changes: 9 additions & 0 deletions core/node/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func Pinning(bstore blockstore.Blockstore, ds format.DAGService, repo repo.Repo)
return pinning, nil
}

var (
_ merkledag.SessionMaker = new(syncDagService)
_ format.DAGService = new(syncDagService)
)

// syncDagService is used by the Pinner to ensure data gets persisted to the underlying datastore
type syncDagService struct {
format.DAGService
Expand All @@ -75,6 +80,10 @@ func (s *syncDagService) Sync() error {
return s.syncFn()
}

func (s *syncDagService) Session(ctx context.Context) format.NodeGetter {
return merkledag.NewSession(ctx, s.DAGService)
}

// Dag creates new DAGService
func Dag(bs blockservice.BlockService) format.DAGService {
return merkledag.NewDAGService(bs)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/gogo/protobuf v1.3.1
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/golang-lru v0.5.4
github.com/ipfs/go-bitswap v0.2.11
github.com/ipfs/go-bitswap v0.2.12
github.com/ipfs/go-block-format v0.0.2
github.com/ipfs/go-blockservice v0.1.3
github.com/ipfs/go-cid v0.0.5
Expand Down Expand Up @@ -46,7 +46,7 @@ require (
github.com/ipfs/go-ipld-git v0.0.3
github.com/ipfs/go-ipns v0.0.2
github.com/ipfs/go-log v1.0.4
github.com/ipfs/go-merkledag v0.3.1
github.com/ipfs/go-merkledag v0.3.2
github.com/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-metrics-prometheus v0.0.2
github.com/ipfs/go-mfs v0.1.1
Expand Down
Loading

0 comments on commit 6f1cedd

Please sign in to comment.