From 61b3670113b972ca418d3a2bdfc002eda6825cdf Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Tue, 24 Jun 2025 00:44:45 -0300 Subject: [PATCH] lntest: do not do IO under mutex in fee_service If HTTP response is consumed slowly, this might block other HTTP requests to the fee service, because the mutex is held. --- lntest/fee_service.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lntest/fee_service.go b/lntest/fee_service.go index 5138e05d6..b65cdc66a 100644 --- a/lntest/fee_service.go +++ b/lntest/fee_service.go @@ -115,14 +115,13 @@ func (f *FeeService) Start() error { // handleRequest handles a client request for fee estimates. func (f *FeeService) handleRequest(w http.ResponseWriter, _ *http.Request) { f.lock.Lock() - defer f.lock.Unlock() - bytes, err := json.Marshal( chainfee.WebAPIResponse{ FeeByBlockTarget: f.feeRateMap, MinRelayFeerate: f.minRelayFeerate, }, ) + f.lock.Unlock() require.NoErrorf(f, err, "cannot serialize estimates") _, err = io.WriteString(w, string(bytes))