Unverified Commit 61f4b5aa authored by Pierre R's avatar Pierre R Committed by GitHub

accounts/abi/bind: fix gas price suggestion with pre EIP-1559 clients (#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.
parent 35dbf7a8
...@@ -256,13 +256,10 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i ...@@ -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") return nil, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")
} }
if opts.GasPrice == nil { if opts.GasPrice == nil {
price, err := c.transactor.SuggestGasTipCap(ensureContext(opts.Context)) price, err := c.transactor.SuggestGasPrice(ensureContext(opts.Context))
if err != nil { if err != nil {
return nil, err return nil, err
} }
if head.BaseFee != nil {
price.Add(price, head.BaseFee)
}
opts.GasPrice = price opts.GasPrice = price
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment