Skip to content

Commit

Permalink
accounts/abi/bind: fix gas price suggestion with pre EIP-1559 clients (
Browse files Browse the repository at this point in the history
…#23102)

This fixes transaction sending in the case where an app using go-ethereum v1.10.4
is talking to a pre-EIP-1559 RPC node. In this case, the eth_maxPriorityFeePerGas
endpoint is not available and we can only rely on eth_gasPrice.
  • Loading branch information
dahu33 authored Jun 29, 2021
1 parent 35dbf7a commit 61f4b5a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,10 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
return nil, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")
}
if opts.GasPrice == nil {
price, err := c.transactor.SuggestGasTipCap(ensureContext(opts.Context))
price, err := c.transactor.SuggestGasPrice(ensureContext(opts.Context))
if err != nil {
return nil, err
}
if head.BaseFee != nil {
price.Add(price, head.BaseFee)
}
opts.GasPrice = price
}
}
Expand Down

0 comments on commit 61f4b5a

Please sign in to comment.