From cd9c09f384f79d1336da1af14eb8c0b8820ee815 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 14 Jan 2025 10:56:14 +0800 Subject: [PATCH] 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 --- accounts/abi/bind/base.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go index bdc479537d9b..36472f81fe18 100644 --- a/accounts/abi/bind/base.go +++ b/accounts/abi/bind/base.go @@ -377,6 +377,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 {