Skip to content

Commit

Permalink
Merge pull request #4 from binance-chain/faucet
Browse files Browse the repository at this point in the history
[R4R]add use fix gas price option for faucet
  • Loading branch information
unclezoro authored Mar 31, 2020
2 parents 728978d + c80932e commit 5c97c1e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ var (

noauthFlag = flag.Bool("noauth", false, "Enables funding requests without authentication")
logFlag = flag.Int("loglevel", 3, "Log level to use for Ethereum and the faucet")

fixGasPrice = flag.Int64("faucet.fixedprice", 0, "Will use fixed gas price if specified")
)

var (
Expand Down Expand Up @@ -569,8 +571,12 @@ func (f *faucet) refresh(head *types.Header) error {
if nonce, err = f.client.NonceAt(ctx, f.account.Address, head.Number); err != nil {
return err
}
if price, err = f.client.SuggestGasPrice(ctx); err != nil {
return err
if fixGasPrice != nil && *fixGasPrice > 0 {
price = big.NewInt(*fixGasPrice)
} else {
if price, err = f.client.SuggestGasPrice(ctx); err != nil {
return err
}
}
// Everything succeeded, update the cached stats and eject old requests
f.lock.Lock()
Expand Down

0 comments on commit 5c97c1e

Please sign in to comment.