From a166964a34a35ceae4646661aecbf8af5cdc7182 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 26 Oct 2021 23:19:12 +1000 Subject: [PATCH] Document why CheckForVerifiedTransactions is required (#2955) --- zebrad/src/components/mempool.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zebrad/src/components/mempool.rs b/zebrad/src/components/mempool.rs index e8da1831..302b5430 100644 --- a/zebrad/src/components/mempool.rs +++ b/zebrad/src/components/mempool.rs @@ -98,6 +98,16 @@ pub enum Request { /// but we can't rely on peers to send queries regularly, /// and crawler queue requests depend on peer responses. /// Also, crawler requests aren't frequent enough for transaction propagation. + /// + /// # Correctness + /// + /// This request is required to avoid hangs in the mempool. + /// + /// The queue checker task can't call `poll_ready` directly on the [`Mempool`] service, + /// because the mempool service is wrapped in a `Buffer`. + /// Calling [`Buffer::poll_ready`] reserves a buffer slot, which can cause hangs when + /// too many slots are reserved but unused: + /// https://docs.rs/tower/0.4.10/tower/buffer/struct.Buffer.html#a-note-on-choosing-a-bound CheckForVerifiedTransactions, }