From 33883c04e4272a2c1e43d5a55ba7fe3eefdeb2bd Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 20 Sep 2021 14:16:55 +1000 Subject: [PATCH] Filter next requests application for peer state changes --- requesting.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/requesting.go b/requesting.go index 7e42baba..3d29d481 100644 --- a/requesting.go +++ b/requesting.go @@ -132,6 +132,11 @@ func (p *Peer) applyNextRequestState() bool { } } for req := range next.Requests { + // This could happen if the peer chokes us between the next state being generated, and us + // trying to transmit the state. + if p.peerChoking && !p.peerAllowedFast.Contains(bitmap.BitIndex(req.Index)) { + continue + } more, err := p.request(req) if err != nil { panic(err) -- 2.44.0