Skip to content

Commit e59bf1e

Browse files
committed
fix: fix duplicate block issue in bitswap
1. Increase broadcast timeout. 2. Fix use of sessions when pinning. This also includes some bitswap changes to reduce some memory allocations and optimize some hot spots.
1 parent 8cb67ab commit e59bf1e

File tree

3 files changed

+15
-94
lines changed

3 files changed

+15
-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

+4-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
@@ -107,3 +107,5 @@ require (
107107
)
108108

109109
go 1.13
110+
111+
replace github.com/ipfs/go-bitswap => /home/steb/.local/share/go/src/github.com/ipfs/go-bitswap

0 commit comments

Comments
 (0)