In justification_requests.rs active_requests are moved to pending_requests when sync peer disconnects:
|
pub(crate) fn peer_disconnected(&mut self, who: &PeerId) { |
|
if let Some(request) = self.active_requests.remove(who) { |
|
self.pending_requests.push_front(request); |
|
} |
|
} |
When receiving a response the code relies on the request being present in active_requests:
|
if let Some(request) = self.active_requests.remove(&who) { |
|
if let Some(r) = resp { |
|
trace!(target: LOG_TARGET, |
|
"Queuing import of {} from {:?} for {:?}", |
|
self.request_type_name, who, request, |
|
); |
|
|
|
self.importing_requests.insert(request); |
|
return Some((who, request.0, request.1, r)) |
We can hit a race condition if the response from the request-response protocol is delivered after the sync peer disconnect event from the notifications protocol.
In
justification_requests.rsactive_requestsare moved topending_requestswhen sync peer disconnects:polkadot-sdk/substrate/client/network/sync/src/justification_requests.rs
Lines 117 to 121 in 946afaa
When receiving a response the code relies on the request being present in
active_requests:polkadot-sdk/substrate/client/network/sync/src/justification_requests.rs
Lines 132 to 140 in 946afaa
We can hit a race condition if the response from the request-response protocol is delivered after the sync peer disconnect event from the notifications protocol.