From 5c9a8d72987ef52b158cc0a86f50a317ff98bc87 Mon Sep 17 00:00:00 2001 From: elraphty Date: Fri, 8 Mar 2024 16:31:57 +0100 Subject: [PATCH] added mutex lock to budget withdrawal --- handlers/bounty.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handlers/bounty.go b/handlers/bounty.go index 350e5fe07..e7a24b68f 100644 --- a/handlers/bounty.go +++ b/handlers/bounty.go @@ -543,6 +543,9 @@ func (h *bountyHandler) MakeBountyPayment(w http.ResponseWriter, r *http.Request } func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Request) { + var m sync.Mutex + m.Lock() + ctx := r.Context() pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) @@ -599,6 +602,8 @@ func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Requ errMsg := formatPayError("Could not pay lightning invoice") json.NewEncoder(w).Encode(errMsg) } + + m.Unlock() } func formatPayError(errorMsg string) db.InvoicePayError {