From 09034bd0f3b8cac1acf8f149c993c8c8deb210f3 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Mon, 1 Nov 2021 10:01:22 +0100 Subject: [PATCH] accounts/abi/bind/backends: make suggestGasPrice compatible with non-1559 chains (#23840) --- accounts/abi/bind/backends/simulated.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 236d3210f986..39a98405eb48 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -315,7 +315,10 @@ func (b *SimulatedBackend) PendingNonceAt(ctx context.Context, account common.Ad // SuggestGasPrice implements ContractTransactor.SuggestGasPrice. Since the simulated // chain doesn't have miners, we just return a gas price of 1 for any call. func (b *SimulatedBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error) { - return b.pendingBlock.Header().BaseFee, nil + if b.pendingBlock.Header().BaseFee != nil { + return b.pendingBlock.Header().BaseFee, nil + } + return big.NewInt(1), nil } // SuggestGasTipCap implements ContractTransactor.SuggestGasTipCap. Since the simulated