diff --git a/mempool/v1/mempool.go b/mempool/v1/mempool.go index f84b20553..135ce19d3 100644 --- a/mempool/v1/mempool.go +++ b/mempool/v1/mempool.go @@ -395,12 +395,11 @@ func (txmp *TxMempool) Update( newPreFn mempool.PreCheckFunc, newPostFn mempool.PostCheckFunc, ) error { - // TODO(creachadair): This would be a nice safety check but requires Go 1.18. - // // Safety check: The caller is required to hold the lock. - // if txmp.mtx.TryLock() { - // txmp.mtx.Unlock() - // panic("mempool: Update caller does not hold the lock") - // } + // Safety sanity check: The caller is required to hold the lock. + if txmp.mtx.TryLock() { + txmp.mtx.Unlock() + panic("mempool: Update caller does not hold the lock") + } // Safety check: Transactions and responses must match in number. if len(blockTxs) != len(deliverTxResponses) { panic(fmt.Sprintf("mempool: got %d transactions but %d DeliverTx responses",