From 86c7e92966d12dc307ed31730a0abd73f97cd373 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 24 Apr 2024 16:16:40 +0200 Subject: [PATCH] fix: disable bitswap provider announcements --- CHANGELOG.md | 2 ++ setup.go | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba997a0..52bb573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/setup.go b/setup.go index d54fbea..4367312 100644 --- a/setup.go +++ b/setup.go @@ -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 { @@ -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 } @@ -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)