Skip to content

Commit 538f763

Browse files
pdyragaholiman
authored andcommitted
accounts/abi/bind: take into account gas price during gas estimation (#20189)
The gas price was not passed to the `EstimateGas` function. As a result, conditional execution paths depending on `tx.gasprice` could be not correctly processed and we could get invalid gas estimates for contract function calls.
1 parent d4bb379 commit 538f763

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

accounts/abi/bind/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
218218
}
219219
}
220220
// If the contract surely has code (or code is not needed), estimate the transaction
221-
msg := ethereum.CallMsg{From: opts.From, To: contract, Value: value, Data: input}
221+
msg := ethereum.CallMsg{From: opts.From, To: contract, GasPrice: gasPrice, Value: value, Data: input}
222222
gasLimit, err = c.transactor.EstimateGas(ensureContext(opts.Context), msg)
223223
if err != nil {
224224
return nil, fmt.Errorf("failed to estimate gas needed: %v", err)

0 commit comments

Comments
 (0)