lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
900 stars 183 forks source link

query: use per-query matchSignals. #162

Closed halseth closed 5 years ago

halseth commented 5 years ago

This fixes an issue that could happen if a response to a previously timed out query was received during sync. This could cause the response handler to send on the peer's matchSignal, but the peerGoroutine was no longer listening on the channel, causing sync to stall.

Instead we tie the matchSignal channel to the specific query, such that we know that we only send the signal if the current query is successfully handled, and we buffer the channel to ensure no blocking even after a timeout.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.05%) to 68.913% when pulling 77299f45e0d3dd95b9ad4a2a269751d476d42d63 on halseth:query-consume-matchsignal into 1d284ac5d51c9a8851e2ed7d64e933951d99e7b2 on lightninglabs:master.

halseth commented 5 years ago

PTAL @wpaulino