forked from cerc-io/plugeth
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.
This commit is contained in:
parent
35dbf7a8a3
commit
61f4b5aa89
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user