Skip to content

Commit 6f1cedd

Browse files
authored
Merge pull request #7202 from ipfs/fix/duplicate-blocks
fix: fix duplicate block issue in bitswap
2 parents 8cb67ab + 5d13ac3 commit 6f1cedd

File tree

3 files changed

+13
-94
lines changed

3 files changed

+13
-94
lines changed

core/node/core.go

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ func Pinning(bstore blockstore.Blockstore, ds format.DAGService, repo repo.Repo)
6565
return pinning, nil
6666
}
6767

68+
var (
69+
_ merkledag.SessionMaker = new(syncDagService)
70+
_ format.DAGService = new(syncDagService)
71+
)
72+
6873
// syncDagService is used by the Pinner to ensure data gets persisted to the underlying datastore
6974
type syncDagService struct {
7075
format.DAGService
@@ -75,6 +80,10 @@ func (s *syncDagService) Sync() error {
7580
return s.syncFn()
7681
}
7782

83+
func (s *syncDagService) Session(ctx context.Context) format.NodeGetter {
84+
return merkledag.NewSession(ctx, s.DAGService)
85+
}
86+
7887
// Dag creates new DAGService
7988
func Dag(bs blockservice.BlockService) format.DAGService {
8089
return merkledag.NewDAGService(bs)

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/gogo/protobuf v1.3.1
1515
github.com/hashicorp/go-multierror v1.1.0
1616
github.com/hashicorp/golang-lru v0.5.4
17-
github.com/ipfs/go-bitswap v0.2.11
17+
github.com/ipfs/go-bitswap v0.2.12
1818
github.com/ipfs/go-block-format v0.0.2
1919
github.com/ipfs/go-blockservice v0.1.3
2020
github.com/ipfs/go-cid v0.0.5
@@ -46,7 +46,7 @@ require (
4646
github.com/ipfs/go-ipld-git v0.0.3
4747
github.com/ipfs/go-ipns v0.0.2
4848
github.com/ipfs/go-log v1.0.4
49-
github.com/ipfs/go-merkledag v0.3.1
49+
github.com/ipfs/go-merkledag v0.3.2
5050
github.com/ipfs/go-metrics-interface v0.0.1
5151
github.com/ipfs/go-metrics-prometheus v0.0.2
5252
github.com/ipfs/go-mfs v0.1.1

0 commit comments

Comments
 (0)