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
pull/26116/head
Saman H. Pasha 2 years ago committed by GitHub
parent 6d55908347
commit 33e23ee37d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      accounts/abi/bind/base.go

@ -373,6 +373,8 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
)
if opts.GasPrice != nil {
rawTx, err = c.createLegacyTx(opts, contract, input)
} else if opts.GasFeeCap != nil && opts.GasTipCap != nil {
rawTx, err = c.createDynamicTx(opts, contract, input, nil)
} else {
// Only query for basefee if gasPrice not specified
if head, errHead := c.transactor.HeaderByNumber(ensureContext(opts.Context), nil); errHead != nil {

Loading…
Cancel
Save