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:
Saman H. Pasha 2022-11-05 00:33:34 +03:30 committed by GitHub
parent 6d55908347
commit 33e23ee37d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {