From 61f4b5aa8927c224eacc7e9e87f63e67c4aea1dc Mon Sep 17 00:00:00 2001
From: Pierre R
Date: Tue, 29 Jun 2021 17:57:29 +0900
Subject: [PATCH] accounts/abi/bind: fix gas price suggestion with pre EIP-1559
clients (#23102)
This fixes transaction sending in the case where an app using go-ethereum v1.10.4
is talking to a pre-EIP-1559 RPC node. In this case, the eth_maxPriorityFeePerGas
endpoint is not available and we can only rely on eth_gasPrice.
---
accounts/abi/bind/base.go | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go
index 25757f1d6..274f6e4d9 100644
--- a/accounts/abi/bind/base.go
+++ b/accounts/abi/bind/base.go
@@ -256,13 +256,10 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
return nil, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")
}
if opts.GasPrice == nil {
- price, err := c.transactor.SuggestGasTipCap(ensureContext(opts.Context))
+ price, err := c.transactor.SuggestGasPrice(ensureContext(opts.Context))
if err != nil {
return nil, err
}
- if head.BaseFee != nil {
- price.Add(price, head.BaseFee)
- }
opts.GasPrice = price
}
}