Skip to content

Commit

Permalink
Allow setting gasPrice smaller than suggested (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominator008 authored Apr 10, 2022
1 parent 79d8ef0 commit 16ff335
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions eth/transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const (
)

var (
ErrExceedMaxGas = errors.New("suggested gas price exceeds max allowed")
ErrConflictingGasFlags = errors.New("cannot specify both legacy and EIP-1559 gas flags")

ctxTimeout = 10 * time.Second
Expand Down Expand Up @@ -292,10 +291,10 @@ func determineLegacyGasPrice(
}
if txopts.maxGasGwei > 0 { // maxGas 0 means no cap on gas price
maxPrice := new(big.Int).SetUint64(txopts.maxGasGwei * 1e9)
// GasPrice is larger than allowed cap, return error
// GasPrice is larger than allowed cap, use maxPrice but log warning
if maxPrice.Cmp(gasPrice) < 0 {
log.Warnf("suggested gas price %s larger than cap %s", gasPrice, maxPrice)
return ErrExceedMaxGas
gasPrice = maxPrice
}
}
signer.GasPrice = gasPrice
Expand Down

0 comments on commit 16ff335

Please sign in to comment.