Skip to content

Commit c80932e

Browse files
committed
add use fix gas price option for faucet
1 parent 0e3d7c4 commit c80932e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/faucet/faucet.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ var (
8282

8383
noauthFlag = flag.Bool("noauth", false, "Enables funding requests without authentication")
8484
logFlag = flag.Int("loglevel", 3, "Log level to use for Ethereum and the faucet")
85+
86+
fixGasPrice = flag.Int64("faucet.fixedprice", 0, "Will use fixed gas price if specified")
8587
)
8688

8789
var (
@@ -569,8 +571,12 @@ func (f *faucet) refresh(head *types.Header) error {
569571
if nonce, err = f.client.NonceAt(ctx, f.account.Address, head.Number); err != nil {
570572
return err
571573
}
572-
if price, err = f.client.SuggestGasPrice(ctx); err != nil {
573-
return err
574+
if fixGasPrice != nil && *fixGasPrice > 0 {
575+
price = big.NewInt(*fixGasPrice)
576+
} else {
577+
if price, err = f.client.SuggestGasPrice(ctx); err != nil {
578+
return err
579+
}
574580
}
575581
// Everything succeeded, update the cached stats and eject old requests
576582
f.lock.Lock()

0 commit comments

Comments
 (0)