mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-17 13:36:37 +00:00
accounts/abi.bind: don't fetch head in transact unless required (#25988)
If GasFeeCap and GasTipCap are specified, we don't need to retrieve the head block for constructing a transaction
This commit is contained in:
parent
6d55908347
commit
33e23ee37d
1 changed files with 2 additions and 0 deletions
|
|
@ -373,6 +373,8 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
|
||||||
)
|
)
|
||||||
if opts.GasPrice != nil {
|
if opts.GasPrice != nil {
|
||||||
rawTx, err = c.createLegacyTx(opts, contract, input)
|
rawTx, err = c.createLegacyTx(opts, contract, input)
|
||||||
|
} else if opts.GasFeeCap != nil && opts.GasTipCap != nil {
|
||||||
|
rawTx, err = c.createDynamicTx(opts, contract, input, nil)
|
||||||
} else {
|
} else {
|
||||||
// Only query for basefee if gasPrice not specified
|
// Only query for basefee if gasPrice not specified
|
||||||
if head, errHead := c.transactor.HeaderByNumber(ensureContext(opts.Context), nil); errHead != nil {
|
if head, errHead := c.transactor.HeaderByNumber(ensureContext(opts.Context), nil); errHead != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue