Skip to content

Commit a9b530c

Browse files
authored
Merge pull request #9984 from starius/lntest-feeservice-mutex
lntest: do not do IO under mutex in fee_service
2 parents 715cae9 + 61b3670 commit a9b530c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lntest/fee_service.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,13 @@ func (f *FeeService) Start() error {
115115
// handleRequest handles a client request for fee estimates.
116116
func (f *FeeService) handleRequest(w http.ResponseWriter, _ *http.Request) {
117117
f.lock.Lock()
118-
defer f.lock.Unlock()
119-
120118
bytes, err := json.Marshal(
121119
chainfee.WebAPIResponse{
122120
FeeByBlockTarget: f.feeRateMap,
123121
MinRelayFeerate: f.minRelayFeerate,
124122
},
125123
)
124+
f.lock.Unlock()
126125
require.NoErrorf(f, err, "cannot serialize estimates")
127126

128127
_, err = io.WriteString(w, string(bytes))

0 commit comments

Comments
 (0)