From 4d49473616ddfc3c228f93a4a27700e9b410be9a Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 11 Dec 2019 16:23:11 +0100 Subject: [PATCH] Increase faucet limits License: MIT Signed-off-by: Jakub Sztandera --- cmd/lotus-fountain/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/lotus-fountain/main.go b/cmd/lotus-fountain/main.go index 014834664..8538a0af8 100644 --- a/cmd/lotus-fountain/main.go +++ b/cmd/lotus-fountain/main.go @@ -100,7 +100,7 @@ var runCmd = &cli.Command{ IPRate: time.Minute, IPBurst: 5, WalletRate: 15 * time.Minute, - WalletBurst: 1, + WalletBurst: 2, }), minerLimiter: NewLimiter(LimiterConfig{ TotalRate: time.Second, @@ -108,7 +108,7 @@ var runCmd = &cli.Command{ IPRate: 10 * time.Minute, IPBurst: 2, WalletRate: 1 * time.Hour, - WalletBurst: 1, + WalletBurst: 2, }), } @@ -150,7 +150,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) { // Limit based on wallet address limiter := h.limiter.GetWalletLimiter(to.String()) if !limiter.Allow() { - http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests) + http.Error(w, http.StatusText(http.StatusTooManyRequests)+": wallet limit", http.StatusTooManyRequests) return } @@ -170,13 +170,13 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) { limiter = h.limiter.GetIPLimiter(reqIP) if !limiter.Allow() { - http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests) + http.Error(w, http.StatusText(http.StatusTooManyRequests)+": IP limit", http.StatusTooManyRequests) return } // General limiter to allow throttling all messages that can make it into the mpool if !h.limiter.Allow() { - http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests) + http.Error(w, http.StatusText(http.StatusTooManyRequests)+": global limit", http.StatusTooManyRequests) return } @@ -221,20 +221,20 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) { // Limit based on wallet address limiter := h.minerLimiter.GetWalletLimiter(owner.String()) if !limiter.Allow() { - http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests) + http.Error(w, http.StatusText(http.StatusTooManyRequests)+": wallet limit", http.StatusTooManyRequests) return } // Limit based on IP limiter = h.minerLimiter.GetIPLimiter(r.RemoteAddr) if !limiter.Allow() { - http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests) + http.Error(w, http.StatusText(http.StatusTooManyRequests)+": IP limit", http.StatusTooManyRequests) return } // General limiter owner allow throttling all messages that can make it into the mpool if !h.minerLimiter.Allow() { - http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests) + http.Error(w, http.StatusText(http.StatusTooManyRequests)+": global limit", http.StatusTooManyRequests) return }