From fc10fe79860d940213b8b63e5a37057e197643ee Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Tue, 5 Jul 2022 19:24:14 -0700 Subject: [PATCH] Add lock comment. --- internal/mempool/v1/mempool.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/mempool/v1/mempool.go b/internal/mempool/v1/mempool.go index 4afd0509e..7783e0c2e 100644 --- a/internal/mempool/v1/mempool.go +++ b/internal/mempool/v1/mempool.go @@ -693,6 +693,10 @@ func (txmp *TxMempool) recheckTransactions() { "num_txs", txmp.Size(), "height", txmp.height, ) + // N.B.: We have to issue the calls outside the lock. In a local client, + // even an "async" call invokes its callback immediately which will make the + // callback deadlock trying to acquire the same lock. This isn't a problem + // with out-of-process calls, but this has to work for both. txmp.mtx.Unlock() defer txmp.mtx.Lock()