diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2fd621c..db45d6b79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ The following emojis are used to highlight certain changes: ### Fixed +- Fix panic if current live count is greater than broadcast limit [#702](https://github.com/ipfs/boxo/pull/702) + ### Security ## [v0.24.1] diff --git a/bitswap/client/internal/session/sessionwants.go b/bitswap/client/internal/session/sessionwants.go index 97c3e7800..4653ef872 100644 --- a/bitswap/client/internal/session/sessionwants.go +++ b/bitswap/client/internal/session/sessionwants.go @@ -57,7 +57,7 @@ func (sw *sessionWants) GetNextWants() []cid.Cid { currentLiveCount := len(sw.liveWants) toAdd := sw.broadcastLimit - currentLiveCount liveSize := min(toAdd, sw.toFetch.Len()) - if liveSize == 0 { + if liveSize <= 0 { return nil }