From 17c3c69e8cfcd6446ed2ad37fe324413b827805a Mon Sep 17 00:00:00 2001 From: Shahbaz Nazir Date: Fri, 9 Dec 2022 15:00:56 +0100 Subject: [PATCH] fix(faucet): Faucet should not transfer funds after throwring quota errors --- pkg/faucet/cosmosfaucet.go | 2 +- pkg/faucet/server.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/faucet/cosmosfaucet.go b/pkg/faucet/cosmosfaucet.go index 45dfd03..1ca9c9c 100644 --- a/pkg/faucet/cosmosfaucet.go +++ b/pkg/faucet/cosmosfaucet.go @@ -50,7 +50,7 @@ func (f Faucet) ValidateRequest(req TransferRequest) error { for _, coin := range req.Coins { if _, ok := f.MaxCoinsPerAccount[coin.Denom]; ok { if coin.Amount.GT(f.MaxCoinsPerRequest[coin.Denom]) { - return fmt.Errorf("%s is greater than max allowed per request of %s%s", coin.String(), f.MaxCoinsPerRequest[coin.Denom].String(), coin.Amount.String()) + return fmt.Errorf("%s is greater than max allowed per request of %s%s", coin.String(), coin.Denom, f.MaxCoinsPerRequest[coin.Denom].String()) } } else { return fmt.Errorf("Faucet not allowed to distribute %s", coin.Denom) diff --git a/pkg/faucet/server.go b/pkg/faucet/server.go index c7059c1..138d867 100644 --- a/pkg/faucet/server.go +++ b/pkg/faucet/server.go @@ -64,6 +64,7 @@ func (f Faucet) faucetHandler(w http.ResponseWriter, r *http.Request) { return } responseError(w, http.StatusInternalServerError, err) + return } // try performing the transfer