Skip to content

Commit

Permalink
cmd/faucet: fix nonce-gap problem (#22145)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
holiman authored Jan 8, 2021
1 parent 165f53f commit 6b88ab7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/faucet/faucet.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ <h3>How does this work?</h3>
}
// Iterate over our entire local collection and re-render the funding table
var content = "";
for (var i=0; i<requests.length; i++) {
for (var i=requests.length-1; i >= 0; i--) {
var done = requests[i].time == "";
var elapsed = moment().unix()-moment(requests[i].time).unix();

Expand Down

0 comments on commit 6b88ab7

Please sign in to comment.