Skip to content

Commit

Permalink
cmd/faucet: clear reqs list when reorg to lower nonce (#1458)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinglin89 authored Apr 14, 2023
1 parent b4f1cdf commit e4b6ab9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,9 @@ func (f *faucet) refresh(head *types.Header) error {
f.lock.Lock()
f.head, f.balance = head, balance
f.price, f.nonce = price, nonce
if len(f.reqs) > 0 && f.reqs[0].Tx.Nonce() > f.nonce {
f.reqs = f.reqs[:0]
}
for len(f.reqs) > 0 && f.reqs[0].Tx.Nonce() < f.nonce {
f.reqs = f.reqs[1:]
}
Expand Down

0 comments on commit e4b6ab9

Please sign in to comment.