From 6b88ab75bcbc5eaecaf5619ec730aa00f5e7c941 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 8 Jan 2021 11:17:15 +0100 Subject: [PATCH] cmd/faucet: fix nonce-gap problem (#22145) * cmd/faucet: avoid encoding for each client * cmd/faucet: fix flaw in clearing of txs, avoid sending more than necessary * cmd/faucet: fix flaw in tx cropping * cmd/faucet: revert change to not always send tx info * cmd/faucet: review fixes * cmd/faucet: revert #22018, fix order in UI * cmd/faucet: fix lock error * cmd/faucet: revert json changes * squashme --- cmd/faucet/faucet.go | 5 ++--- cmd/faucet/faucet.html | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index 2c0881f5a..b9c4e1819 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -512,12 +512,12 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) { } continue } - f.reqs = append([]*request{{ + f.reqs = append(f.reqs, &request{ Avatar: avatar, Account: address, Time: time.Now(), Tx: signed, - }}, f.reqs...) + }) timeout := time.Duration(*minutesFlag*int(math.Pow(3, float64(msg.Tier)))) * time.Minute grace := timeout / 288 // 24h timeout => 5m grace @@ -670,7 +670,6 @@ func send(conn *wsConn, value interface{}, timeout time.Duration) error { } conn.wlock.Lock() defer conn.wlock.Unlock() - conn.conn.SetWriteDeadline(time.Now().Add(timeout)) return conn.conn.WriteJSON(value) } diff --git a/cmd/faucet/faucet.html b/cmd/faucet/faucet.html index ba1433318..dad5ad84f 100644 --- a/cmd/faucet/faucet.html +++ b/cmd/faucet/faucet.html @@ -177,7 +177,7 @@ } // Iterate over our entire local collection and re-render the funding table var content = ""; - for (var i=0; i= 0; i--) { var done = requests[i].time == ""; var elapsed = moment().unix()-moment(requests[i].time).unix();