Skip to content

Commit

Permalink
added mutex lock to budget withdrawal
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Mar 8, 2024
1 parent 940bea3 commit 5c9a8d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions handlers/bounty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 5c9a8d7

Please sign in to comment.