commit 5a645bbf9847e658d521af74ce952ebfc6b9d733
parent bd7a0af115da5ad1e9c8a69852c39b660a7b3fb5
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 15 Dec 2023 02:43:09 -0500
prevent doing multiple out tx in a short time
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -863,6 +863,13 @@ func PokerHomeHandler(c echo.Context) error {
return c.Render(http.StatusOK, "poker", data)
}
+ lastOutTransaction, _ := db.GetLastUserWithdrawPokerXmrTransaction(authUser.ID)
+ if lastOutTransaction.CreatedAt.After(time.Now().Add(-5 * time.Minute)) {
+ diff := (5 * time.Minute) - time.Now().Sub(lastOutTransaction.CreatedAt)
+ data.Error = fmt.Sprintf("Wait %s before doing a new withdraw transaction", utils.ShortDur(diff))
+ return c.Render(http.StatusOK, "poker", data)
+ }
+
dutils.RootAdminNotify(db, fmt.Sprintf("new withdraw %s xmr by %s", withdrawAmount.XmrStr(), authUser.Username))
tx := db.Begin()