Skip to content

Commit

Permalink
fix: disable bitswap provider announcements
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Apr 24, 2024
1 parent b1983fe commit 6392c9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ The following emojis are used to highlight certain changes:

### Fixed

- Rainbow no longer provides announcements of blocks via Bitswap. This is not needed to provide blocks to peers with `RAINBOW_PEERING_SHARED_CACHE`.

### Security

## [v1.2.0]
Expand Down
5 changes: 1 addition & 4 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ func setupPeering(cfg Config, h host.Host) error {

func setupBitswap(ctx context.Context, cfg Config, h host.Host, cr routing.ContentRouting, bstore blockstore.Blockstore) *bitswap.Bitswap {
var (
provideEnabled bool
peerBlockRequestFilter bsserver.PeerBlockRequestFilter
)
if cfg.PeeringCache && len(cfg.Peering) > 0 {
Expand All @@ -406,13 +405,11 @@ func setupBitswap(ctx context.Context, cfg Config, h host.Host, cr routing.Conte
peers[a.ID] = struct{}{}
}

provideEnabled = true
peerBlockRequestFilter = func(p peer.ID, c cid.Cid) bool {
_, ok := peers[p]
return ok
}
} else {
provideEnabled = false
peerBlockRequestFilter = func(p peer.ID, c cid.Cid) bool {
return false
}
Expand All @@ -433,7 +430,7 @@ func setupBitswap(ctx context.Context, cfg Config, h host.Host, cr routing.Conte

// ---- Server Options
bitswap.WithPeerBlockRequestFilter(peerBlockRequestFilter),
bitswap.ProvideEnabled(provideEnabled),
bitswap.ProvideEnabled(false),
)
bn.Start(bswap)

Expand Down

0 comments on commit 6392c9b

Please sign in to comment.